CodeIgniter Forums
Form validation rule based on 3 fields - 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: Form validation rule based on 3 fields (/showthread.php?tid=22153)



Form validation rule based on 3 fields - El Forum - 08-31-2009

[eluser]Jonas G[/eluser]
Hi all

I have a form with 3 fields: chance_1, chance_0 and chance_2. The sum of chose 3 needs to be exactly 100. What is the best way to do this?

Is it possible to have a callback function that takes 3 parameters? Is it even possible to put the VALUE of a field as the parameter of another fields' callback?

Is it possible to check this via the controller and then specifically calling the form_validation library to generate an error?

I hope to find a solid solution to the problem.

Regards
Jonas