Can't get the Form Validation library to work |
[eluser]AlexJ[/eluser]
Hello, My Form Validation works (it returns false if a field is not OK, and it returns true when all the fields are correct), but it doesnt show any validation errors, I traced it down to the following bit of code: Code: function &_get_validation_object() One little note about the Webshop controller, it extends a custom Controller named V_Controller, which extends the native controller and adds some methods. I am not really familiar with the inner working of CodeIgniter so I have no idea how to fix this. Anyone? Edit: I think it is because the validation_errors is called from a view file, for some reason my libraries are not available in view files (maybe because I use a extending controller?) This occurs even when I autoload the libraries.
[eluser]runrun[/eluser]
After loading the validation class and setting rule (you sure did this) You should have this in your controller Code: $this->form_validation->set_error_delimiters('<span class="error">', '</span>'); And you should have this in your view file in order to display respective errors to respective form fields. Code: <input type="text" name="username"/>
[eluser]AlexJ[/eluser]
Thanks for your reply, aren't delimeters default '<div>', and form_error() also returns an empty string (because the &_get_validation_object() also returns false in that case). Im currently working on a dirty solution, I pass my view files the error message because it is available in my Controller.
[eluser]Flemming[/eluser]
Hey Alex, I don't mean any disrespect but I've been using the form validation library for a long time and there's nothing wrong with it. If you're finding you need to resort to a 'dirty solution' then perhaps you should take a few mins to just re-read the user guide and follow the examples there to the letter. I'm pretty sure you will find it all works perfectly! :-)
[eluser]brianw1975[/eluser]
[quote author="Flemming" date="1260907914"]Hey Alex, I don't mean any disrespect but I've been using the form validation library for a long time and there's nothing wrong with it. If you're finding you need to resort to a 'dirty solution' then perhaps you should take a few mins to just re-read the user guide and follow the examples there to the letter. I'm pretty sure you will find it all works perfectly! :-)[/quote] And make sure you read the right one! (this killed me for an hour or two a long time ago (before they put in the note of being newer), so I know how you feel. Form validation user guide |
Welcome Guest, Not a member yet? Register Sign In |