CodeIgniter Forums
validation callback - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: validation callback (/thread-8355.html)

validation callback - El Forum - 05-15-2008


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

validation callback - El Forum - 05-15-2008

[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?

validation callback - El Forum - 05-15-2008

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

validation callback - El Forum - 05-15-2008

[eluser]Derek Allard[/eluser]

James Gifford proposes a very elegant solution.