I am using CodeIgniter. I have been trying to debug a non-working script.
I have come to the conclusion that when utilizing $this->form_validation->run();
(the form validation class), after the first named call, e.g $this->form_validation->run(form_1);
, all following calls return true.
I am developing a multi step form and when $this->form_validation->run(form_1);
correctly returns true, $this->form_validation->run(form_2);
incorrectly returns true.
Anyone have any clue as to why? Can multiple calls not be held in a single function within a controller or is there a special approach? Cheers
pls check if you have pass argument (form1) and (form2) in your set_rules() function.....and if it's ok then make yourself 1st form_validation call return FALSE, then see if the 2nd call to form_validation is still returning TRUE.
the way codeigniter is setup doesn't lend itself to allow you to validate with multiple rules, you can extend the form helper with a function to group rules (http://ellislab.com/codeigniter/forums/viewthread/120221) or like I did in my
application/config/form_validation.php
I simply combined multiple groups into its own set of rules and referred to the single rule of combined rules.The line of interest is the last one, where the two rules are combined:
$config["campaign_user"] = array_merge($config['campaign'], $config['user']);
and in your controller you would just call the single rule: