Validation and Select Item? [solved] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Validation and Select Item? [solved] (/showthread.php?tid=2065) |
Validation and Select Item? [solved] - El Forum - 07-13-2007 [eluser]Glowball[/eluser] I'm successfully using the validation class with text and textarea fields, but I can't get it to validate a <select> field. How do I do this? In this example, the menu is of all of the states and the values are all two-digit codes. I want to make it required and two digits only. Controller Snippet Code: $rules['state_abbr'] = "exact_length[2]"; View Snippet Code: <select name="state_abbr" size="1"> It's in a form with other text fields and they are getting validated. This one select field is getting skipped. What's the trick? Thanks! Validation and Select Item? [solved] - El Forum - 07-13-2007 [eluser]Glowball[/eluser] I have no idea why, but I added a callback function to it (after the character check) and now it works. I was trying to start simple and that's when it wasn't working. I have no idea why it works, but it does now. Go figure! |