Welcome Guest, Not a member yet? Register   Sign In
How to code checkbox for each record displayed in UI?
#1

[eluser]RickRobinson[/eluser]
I've got a code-ignitor powered web site where my wife and I enter and maintain recipes: www.rickandlynne.com/recipes. There is an "admin" interface that allows us to create new recipes, edit existing recipes, etc. In that interface, there is additional info about each recipe that can be manipulated and searched on. Specifically three flags called "New Recipe", "Try" and "Export". New Recipe gets set by default whenever a new recipe is created. The Try and Export flags are self-explanatory.

Each of these flags is shown in the admin UI, see attached screen shot.

Today, to mark or unmark one of these flags for a recipe, I click on "edit", where a form-based version of the recipe is revealed and I can edit text, set flags, unset flags, etc. There are also some "batch" commands for setting or unsetting these based on whatever is shown in the UI at the time.

What I would like to be able to do is have a checkbox for each flag for each "row" in the UI so that I could check or uncheck the flags without having to bring up the full recipe editor and do them one-at-a-time. I realize that requires a second form on the UI in addition to the search form that is always present.

I have scoured these forums, PHP books, etc for about a year looking for a coding example on how this is done. I see this type of interface everywhere, even in the EE Control Panel ;-) But, I just cannot find any tutorials or code examples of how to make this interface work.

Can anyone send me to a good reference for this? I'm an amateur coder who only occasionally dives into this code, so the more detailed and pedantic the better ;-)
#2

[eluser]smilie[/eluser]
If you want that checkbox immediatelly stores that info in the database (so, you click on it - and it is stored in the database), you will need to use ajax (for example with jquery).

Other option is to put that overview (as I have seen it in PDF) in an form which will only control those checkboxes. So, your overview is form as well - whereby you can only 'edit' checkboxes. To edit rest of the recepie you will click edit as you have done it so far.

First option is more user friendly, but takes more programming.
So I would suggest second one. Simply place form around that view and place checkboxes instead of those icons. Give every checkbox row ID of that recepie and create a controller which will save that data. That's it Smile

Good luck!
Smilie




Theme © iAndrew 2016 - Forum software by © MyBB