CodeIgniter Forums
Multiple Forms different validation_errors() - 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: Multiple Forms different validation_errors() (/showthread.php?tid=58553)



Multiple Forms different validation_errors() - El Forum - 06-23-2013

[eluser]Unknown[/eluser]
Hello,

how can i get differnt validation_errors() on a page with multiple forms? For example i have a login form on every page and an contactformular on one page. If the user forgot the subject in the contactform the error message appear above both forms.

validation_errors()

Thank you!


Multiple Forms different validation_errors() - El Forum - 06-24-2013

[eluser]Pert[/eluser]
For each form, set a different controller or controller method as corresponding action.

In your example, I would expect login page to show me errors on dedicated login page, similar to when you are trying to log into Facebook, if password is wrong, you end on a page that has login form and not much else on it.

You can always capture "referral" either from _SERVER variable or dynamically set it as hidden variable and return to said page after successful login.