Why isn't set_checkbox working for me? |
[eluser]Unknown[/eluser]
Hi everyone, I'll admit up-front that I'm very new to CodeIgniter. I'm creating a set of checkboxes in my PyroCMS admin page using CodeIgniter's form_checkbox and set_checkbox functions: Code: <?php echo form_checkbox('purpose_e', '1', set_checkbox('purpose_e', '1')); ?> Environmental Everything seems to work fine, the page executes and the relevant 1 values are written to the database fields, but when I edit the entry the relevant checkboxes aren't being rechecked, I just get a set of blank unchecked boxes. Is there some elementary mistake I'm making? Thanks in advance for any help, Tony.
[eluser]CroNiX[/eluser]
Yes, set_checkbox() is only for if you are manually writing the html checkbox form element. You are using the form helper to generate your checkboxes. Try using set_value(). The 2nd value for the default should be a boolean, like TRUE/FALSE, not a string like '1'.
[eluser]Aken[/eluser]
I touched on this a while back, maybe it will help you: http://ellislab.com/forums/viewthread/194556/ |
Welcome Guest, Not a member yet? Register Sign In |