Repopulating checkbox using CI syntax: confused. |
[eluser]moonbeetle[/eluser]
Hi, from what I see in the user guide, set_checkbox() isn't meant to be used with the form_checkbox() method. Looks like set_checkbox() can only be used if you literally follow the example in the user guide, thus adding checkboxes in plain old HTML style, not CI generated style. Found a small error in your code, to output a checkbox CI style, use form_checkbox() instead of form_input. Also, for a checkbox, the data array can have a key called 'checked' which you set to have a value of TRUE/FALSE. This can be done hardcoded or dynamically (by matching the value of the checkbox). Code: // CI generated checkbox, checked='checked' by default About your question, "Repopulating", suggests you want to display the form again, after submit. Worth checking CI's validation class in combination with the form helper and validating arrays. |
Messages In This Thread |
Repopulating checkbox using CI syntax: confused. - by El Forum - 08-23-2009, 10:59 AM
Repopulating checkbox using CI syntax: confused. - by El Forum - 08-24-2009, 12:41 AM
Repopulating checkbox using CI syntax: confused. - by El Forum - 08-24-2009, 05:12 AM
Repopulating checkbox using CI syntax: confused. - by El Forum - 12-26-2010, 03:53 PM
|