![]() |
Quick Question - How to clear the form validation rules and errors? - 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: Quick Question - How to clear the form validation rules and errors? (/showthread.php?tid=53142) |
Quick Question - How to clear the form validation rules and errors? - El Forum - 07-12-2012 [eluser]mlakhara[/eluser] How to clear the form validation rules and errors? Thanks in advance Quick Question - How to clear the form validation rules and errors? - El Forum - 07-12-2012 [eluser]Jason Hamilton-Mascioli[/eluser] Without knowing exactly what you are doing you can try to unset validation Code: if ($this->validation->run() == TRUE) { Quick Question - How to clear the form validation rules and errors? - El Forum - 07-12-2012 [eluser]mlakhara[/eluser] Thanks for your prompt reply. I am trying to achieve a form based authentivation in which username or email can be used. I am using form_validation to check if the user entered an email or just username. after that I am setting validation for them seperately. Code: $this->form_validation->set_rules('username','Username','valid_email'); I tried to use your approach but then I am unable to use the validation again. getting the following error. Code: A PHP Error was encountered Quick Question - How to clear the form validation rules and errors? - El Forum - 07-12-2012 [eluser]Aken[/eluser] There's no need to do all that extra stuff for such a simple form. Just check the database to see if the email exists first, and then if not, check for the username. If neither exist, throw an error. If one exists, that's the user you'll check against. |