Form Validation - 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 (/showthread.php?tid=22346) |
Form Validation - El Forum - 09-06-2009 [eluser]learning_php[/eluser] I am trying to get Form validation to display correctly and re-populate the form but for some reason all the validation errors are in a list at the stop instead of showing the errors individually? controller Code: <?php Code: <html> Form Validation - El Forum - 09-06-2009 [eluser]Mareshal[/eluser] first of all, even you copied the text wrong, or this is your real code. 1# you don't have a constructor in your controller: http://ellislab.com/codeigniter/user-guide/general/controllers.html#constructors 2# you didn't initialize your db library and form_validation: http://ellislab.com/codeigniter/user-guide/database/examples.html http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html 3# to display error individually, <?=form_error('you_field_name')?> 4# if you don't use global XSS_CLEAN = TRUE in your config, do not trow all your post in database $this->db->insert('contacts',$_POST); //NO either you use after "required|xss_clean" or you use something like this: $post['your_field_name'] = $this->input->post('your_field_name', TRUE); //TRUE is for xss_clean good luck Form Validation - El Forum - 09-06-2009 [eluser]tim1965[/eluser] Go to the Userguide http://ellislab.com/codeigniter/user-guide/libraries/form_validation.html and read. You will get all the answers you require |