How do I add a custom rule for form validation? - 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: How do I add a custom rule for form validation? (/showthread.php?tid=32125) |
How do I add a custom rule for form validation? - El Forum - 07-13-2010 [eluser]dallen33[/eluser] I'm building a registration form, and when the form submits, I want it to check to see if the username exists. Right now, I'm doing it with a AJAX call that returns "username exists" or "username okay" while the user is typing. But I also want to check it while I'm validating. Code: $this->form_validation->set_rules('username', 'Username', 'required'); So I have 'required', but how could I also add something like 'username_check'? How would I go about this? I read the user guide but I can't seem to figure it out. How do I add a custom rule for form validation? - El Forum - 07-13-2010 [eluser]dallen33[/eluser] Ah shoot. I didn't scroll down to Callbacks. Ignore this post! I apologize. How do I add a custom rule for form validation? - El Forum - 07-13-2010 [eluser]Luis Perez[/eluser] You can extend the form validation class too |