CodeIgniter Forums
Form Validation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Form Validation (/showthread.php?tid=67493)



Form Validation - usr_ny - 02-28-2017

I have a form on an index page (controllername/)

That form does a POST to controllername/create

The form validation isĀ in the index method of the controllername class.

When the form is submitted, the validation doesn't happen.

What am I doing wrong?


RE: Form Validation - Wouter60 - 02-28-2017

CI performs form validation when the form input has been posted.
So move your form validation to the create method.

A better way is to keep the code for displaying the form and performing the form validation within one method.
As described in the documentation:
https://www.codeigniter.com/userguide3/libraries/form_validation.html#the-controller


RE: Form Validation - usr_ny - 03-01-2017

Thank you.