CodeIgniter Forums
How to call a form validation callback function not tied to a field? - 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: How to call a form validation callback function not tied to a field? (/showthread.php?tid=20025)



How to call a form validation callback function not tied to a field? - El Forum - 06-25-2009

[eluser]heat23[/eluser]
I have a form with several fields that I run validations on but I also want to validate some info from a database. How can I use the set_rules() to call my own callback functions but not tie it in to a particular field?


How to call a form validation callback function not tied to a field? - El Forum - 06-26-2009

[eluser]TheFuzzy0ne[/eluser]
Any validation method has access to all of the post array, so that shouldn't be a problem. The only problem is reporting errors, since that has to be tied to a single field. But there's nothing stopping you from having your custom validation call back from setting specific properties on your controller for you to access.