Form_Validation configuration not repopulating (maybe not even working?) |
[eluser]Unknown[/eluser]
I'm having a small issue with CI's integrated form_validation class. Right now I have my rules working by setting them with Code: $this->form_validation->set_rules('fieldname', 'humanname', 'rules') I used the multi-tier set up, since later down the road I will have multiple forms. An example of my config was Code: $config = array( Then added Code: $this->form_validation->run('gameform') So this is a pretty beginner's problem, any ideas what would cause this to happen - or does re-population not work the same when using this set-up compared to setting the rules in the controller? Or can I not use the multi-tier set up with only one value.
[eluser]InsiteFX[/eluser]
Without seeing your form code I would say that you need to use set_value in your form code! Read the User Guide on Form_Validation class and the form_helper. InsiteFX
[eluser]Unknown[/eluser]
I have set_value, and form_error set for all fields to be validated. I have it all working flawlessly when I insert the values into my controller. Code: $this->form_validation->set_rules('field','name','rules'); // Pretend there are 20 of these. Works, but when I remove the validation rules from my controller and set them into the configuration form_validation.php file, then it doesn't work.
[eluser]InsiteFX[/eluser]
You should be using CI input below, now $__Post[]! Code: $data = $this->input->xss_clean($data); Did you also load the form_helper? Also your config should be like this: Code: $config = array( InsiteFX
[eluser]Nisha S.[/eluser]
If there is no need for validating the fields then only load the form helper. If the form validation library is loaded then the set_value takes the value from the library object otherwise it refers to the $_POST array. You may get some more info from one of my post at http://www.betterhelpworld.com/codeignit...odeigniter |
Welcome Guest, Not a member yet? Register Sign In |