Problem validating form data on a single 'page' |
[eluser]SSgt Dodger USMC[/eluser]
I have a HelpDesk program I am beginning to write in CI and I am having trouble creating a form that validates. Before I begin, I am autoloading the following: $autoload['libraries'] = array('database','session','email','validation','form_validation'); $autoload['helper'] = array('url','form','text','date','security','html'); I have a controller called helpdesk with a function called newnewticket that I want to invoke some views and collect information from brand new users on my intranet. Here is relevant part of the helpdesk controller: Code: class Helpdesk extends Controller { // THIS CLASS NAME MUST BE CAPITALIZED Then I have a view called newnewticket that I want to present the user with a form to collect the data, and all display any validation errors encountered: Code: <?php Then I have a validation controller with a newusercheck function: Code: class Validation extends Controller { // THIS CLASS NAME MUST BE CAPITALIZED When I run this, it will take me back to a blank form on the newnewticket page, and displays no error message. It doesn't matter what I fill in or if it is valid or not. AM I doing this right? Is there a simpler/better way? I have read the user manual on forms and form validation but I am stuck... I am new to CI, and I would greatly appreciate any help or guidance. Semper Fidelis, -Dodger
[eluser]pistolPete[/eluser]
You mix up the two libraries Validation and Form Validation, just use the latter! From the user guide: Quote:As of CodeIgniter 1.7.0, this Form Validation class supercedes the old Validation class, which is now deprecated. We have left the old class in the library so applications currently using it will not break, but you are encouraged to migrate to this new version. In order to repopulate the form, use Code: set_value('field_name') Code: set_value($this->validation->field_name) Have a look at the form validation tutorial again!
[eluser]SSgt Dodger USMC[/eluser]
Thank you pistolPete!! I was mixing them up, and I didn't even see it. It's working great now! |
Welcome Guest, Not a member yet? Register Sign In |