CodeIgniter Forums
set_checkbox after form validation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: set_checkbox after form validation (/thread-43690.html)



set_checkbox after form validation - El Forum - 07-20-2011

[eluser]Wonder Woman[/eluser]
Hi,

I have a checkbox which has a null value, which I would like to be 0 and when the user clicks on it for it to change to 1.

I have form validation set up but when the form is repopulated with the sent form data the checkbox does not change.

If anyone can help me that would be great.

Code:
echo form_label('Anonymous', 'anonymous');
echo form_checkbox('anonymous', set_checkbox('anonymous'), FALSE);

Thanks!


set_checkbox after form validation - El Forum - 07-20-2011

[eluser]Armchair Samurai[/eluser]
AFAIK, set_checkbox() and form_checkbox() are incompatible. You'll need to write out the HTML if you want to use set_checkbox().


set_checkbox after form validation - El Forum - 07-20-2011

[eluser]Wonder Woman[/eluser]
Thanks for the point out - fixed it! Cheers Smile