![]() |
trigger form_error without going through the form_validation->run() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: trigger form_error without going through the form_validation->run() (/showthread.php?tid=27386) |
trigger form_error without going through the form_validation->run() - El Forum - 02-09-2010 [eluser]Dennis_gull[/eluser] Is it possible to trigger the the form_error without using $this->form_validation->run()? For example if a user is signing in I want the regular validation to run then after the validation I want to check the database to see if the information match anyone, if it does I need to take this information and save it in the session, example: Code: if( $this->form_validation->run('login_user') ) For this example I can't use a custom_validation because I need the user information after the validation and I don't want to run the query twice. trigger form_error without going through the form_validation->run() - El Forum - 02-09-2010 [eluser]OliverHR[/eluser] I think the anwser is no. You can try to validate your query with a Callback. trigger form_error without going through the form_validation->run() - El Forum - 02-09-2010 [eluser]Dennis_gull[/eluser] [quote author="OliverHR" date="1265752761"]You can try to validate your query with a Callback.[/quote] Yeah but then I won't get the query result once its validated. trigger form_error without going through the form_validation->run() - El Forum - 02-12-2010 [eluser]Dennis_gull[/eluser] I had to create a solution for this so I put the following function in my MY_form_validation.php: Code: function set_error($field, $message, $label = '') then you use it like this: Code: $this->form_validation->set_error('my_form_field','my_language_field', 'lang:my_label'); |