Form Validation in a Library - please help - 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: Form Validation in a Library - please help (/showthread.php?tid=21430) |
Form Validation in a Library - please help - El Forum - 08-10-2009 [eluser]Sean Downey[/eluser] Hi I've had a look around but couldn't find anything about this. I am trying to get form validation with the new form_validation class working from inside a library. The problem is that the actual validation is working fine but then when I try to display the errors in the views the "form_error" and "validation_errors" functions will not display the errors. Code: // inside the library constructor Code: if ($this->CI->form_validation->run() == FALSE) { The validation_errors function is not finding the validation_object Code: if (FALSE === ($OBJ =& _get_validation_object())) Does anyone know how I can get around this? Form Validation in a Library - please help - El Forum - 08-10-2009 [eluser]hugle[/eluser] Hello, try instead: echo validation_errors(); this: print_r validation_errors(); or for example: print_r form_error('username'); where useranme is a 'name' of a field Hope it helps! Form Validation in a Library - please help - El Forum - 08-10-2009 [eluser]Sean Downey[/eluser] [quote author="hugle" date="1249914968"] try this: print_r validation_errors(); [/quote] Thanks but the validation object isn't found inside those functions to they return blank. |