SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e - 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: SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e (/showthread.php?tid=41571) |
SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e - El Forum - 05-11-2011 [eluser]atno[/eluser] controllers/welcome.php Code: public function index() views/welcome_message.php Code: <?php echo form_open(' ','id="login"');?> So when i just click the submit button i normally get the errors "The character name field is required" and "The password field is required.". But when i enter a name on character name and character name doesnt exists on database i get "Unable to access an error message corresponding to your field name." I tried to add [code]<?php echo form_error('char_check');?> on the view but still the same. What the hell am i doing wrong. Cheers SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e - El Forum - 05-11-2011 [eluser]boltsabre[/eluser] Have you tried setting the error message for char_check inside that function rather than in your index function? May not be the problem, it just seems a little weird to me to separate your custom validation code across two functions. SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e - El Forum - 05-11-2011 [eluser]atno[/eluser] [quote author="boltsabre" date="1305141141"]Have you tried setting the error message for char_check inside that function rather than in your index function? May not be the problem, it just seems a little weird to me to separate your custom validation code across two functions.[/quote] yes i've tried that and getting the following error as $val is declared on index(); A PHP Error was encountered Severity: Notice Message: Undefined variable: val SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e - El Forum - 05-11-2011 [eluser]atno[/eluser] bah, i moved Code: $val->set_message('char_check','You doent exist :). You might want to register first.'); Code: set_rules Code: $val = $this->form_validation; SOLVED: form validation set_message() going nuts "Unable to access an error message corresponding to your field name." e - El Forum - 05-11-2011 [eluser]boltsabre[/eluser] Good good!!! |