Form Validation - set_checkbox() |
[eluser]webtigers[/eluser]
FYI: If you are using CI's automatic form validation (using a form_validation.php file in the /application/config folder) and cannot seem to get set_checkbox() method to work, it's because you need to set a validator for the specific checkbox(es). DOH! Yea, who the hell sets a validator on a check box, but you have to in order to get it to work. The form validation is a very cool feature. Just a little FYI that could be in the docs because it cost me a couple of hours to dig into the CI code and dig this puppy out. ![]()
[eluser]Unknown[/eluser]
Thanks for the hint. I had the same problem and thought I was losing my mind.
[eluser]helloworldly[/eluser]
Quote:FYI: If you are using CI’s automatic form validation (using a form_validation.php file in the /application/config folder) and cannot seem to get set_checkbox() method to work, it’s because you need to set a validator for the specific checkbox(es). DOH! Yea, who the hell sets a validator on a check box, but you have to in order to get it to work. I'm having an issue of getting set_checkbox() working when using multiple checkboxes as an array. Code: // more code And Code: <input type="checkbox" value="XYZ" name="group[]" <?php echo $this->validation->set_checkbox('group', 'XYZ'); ?> /> I am using CI's form validation, but I don't see "a form_validation.php file in the /application/config folder" nor do I know how to "set a validator for the specific checkbox(es)." Thanks for any help!
[eluser]Brad K Morse[/eluser]
@helloworldly, I am having the SAME EXACT problem as you, since it is using multiple checkboxes as an array name="step_id[]" as seen here http://ellislab.com/forums/viewthread/175540/ Was your problem ever resolved? I'd love to know, thanks. |
Welcome Guest, Not a member yet? Register Sign In |