Welcome Guest, Not a member yet? Register   Sign In
Yet another question about validation class
#1

[eluser]Unknown[/eluser]
Hi all,

I'm currently playing around a bit with CI and I was asking myself something :

I got a controller for my homepage, which name is home.php.

I got two forms on this homepage (one for subscription to a newletter and one for performing searchs through the site).

I initialized the Validation library on top of my controller.

Each form has its own function in the controller.
www.mysite.com/index.php/form/newsletter handles the newsletter form while www.mysite.com/index.php/form/search handles the search form.

Now I would like to use the validation library on each form individually. Is there a way to do that in a clean way? maybe there's a way to instanciate more than one Validation objects?

Each time i've been trying this, I had validation working for the first form but failing on the second one ($this->validation->run() is always == FALSE, even if that second form is properly filled).
#2

[eluser]Unknown[/eluser]
I don't understand what you are trying to do...
- you can not submit two forms at the same time, so how can you validate them both?
#3

[eluser]xwero[/eluser]
You should load the validation library in each of the functions so you can set the rules for each form.




Theme © iAndrew 2016 - Forum software by © MyBB