CodeIgniter Forums
validation callback - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: validation callback (/showthread.php?tid=8355)



validation callback - El Forum - 05-15-2008

[eluser]quasiperfect[/eluser]
hi

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

[eluser]quasiperfect[/eluser]
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]
http://ellislab.com/forums/viewthread/79571/#399414

James Gifford proposes a very elegant solution.