CodeIgniter Forums

Full Version: validation callback
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


i have two fields and i need to output a error based on the fields data.
something like the passwords that have to be equal but i don't need them to be eaqual but respect a custom relation.
how can i resolve this using a callback function ? i need to call callback_myfunc($param1,param2) to be able to compare the two values. or any other method to do this ?

thanks in advance for any response

El Forum

[eluser]Pascal Kriete[/eluser]
Put the callback rule on the second field. The parameter to the callback function will be the content of that field. The other one you get using $this->input->post('fieldname');

Does that help?

El Forum

yea i did like u said but would had been nice to have a special function for something like this.
like if is used the same function in 3 rules the function to get the 3 values and so on

El Forum

[eluser]Derek Allard[/eluser]

James Gifford proposes a very elegant solution.