Form_Validation Config file not working - 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: Form_Validation Config file not working (/showthread.php?tid=28883) |
Form_Validation Config file not working - El Forum - 03-24-2010 [eluser]thors1982[/eluser] I have been trying to move my form validation to a config file like in the user guide (here) and it took me hours to figure out its not working because I was setting the delimiters like this Code: $this->set_error_delimiters('<span class="Warning">', '</span>'); In a MY_Form_validation.php (library file). Is there a way to get both... set a global error_delimiter and use the config validation file? Form_Validation Config file not working - El Forum - 03-24-2010 [eluser]Rob Gordijn[/eluser] I'm currently using a MY form validation, the config file with the 'rules' and a 'real' config file (look that one up in the manual) with delemiter_start and delemiter_end. My app is loading and using that config, and I set the formvalidation delemiters with those values. hope u understand, cheers Form_Validation Config file not working - El Forum - 03-24-2010 [eluser]thors1982[/eluser] Not sure I fully understand... but I got it working by doing this Code: class MY_Form_validation extends CI_Form_validation Hopefully nothing is wrong with that method.... I do have another question though. Is it possible to call two $config rule groups? So I could put email on its own group, so I could use it seperatly. But if i wanted to use the email validation on the signup page as well, i could call both groups signup and email. Form_Validation Config file not working - El Forum - 03-25-2010 [eluser]Rob Gordijn[/eluser] yes, that looks good. you can improve somewhat: Code: function __construct($config = array()) instead of setting $rules manually. and yes, I think you can run multiple rules/group's simultaneous if($this->form_validation->run('account/login') === TRUE){ // do shizzle with post vars } if($this->form_validation->run('account/other') === TRUE){ // do other shizzle with post vars } have fun! Form_Validation Config file not working - El Forum - 05-03-2010 [eluser]Esger[/eluser] I had a problem (auto)loading the form validation rules from a file (application/config/form_validation.php) as well. The $config variable was reported not being defined, until I set the rules like this: $this->form_validation->set_rules($this->config->config); And I had to add 'form_validation' to the config files section of the autoload.php file. Form_Validation Config file not working - El Forum - 08-02-2010 [eluser]LairdWirli[/eluser] I have the same problem: Message: Undefined variable: config after I moved the validation rules to (application/config/form_validation.php). I am happy that you found a work around. It doesn't work in my case and I assume there has to be a different/official solution to the problem, since it is described in the official user guide. |