Validation Rules - 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: Validation Rules (/showthread.php?tid=53618) Pages:
1
2
|
Validation Rules - El Forum - 07-31-2012 [eluser]xtremer360[/eluser] I'm trying to figure out why my registration controller is not validating my submit form data. http://www.kansasoutlawwrestling.com/kowmanager/register Registration Controller Code http://pastebin.com/MEinkAtL form_validation rules array which was placed into the application/config folder Code: <?php Validation Rules - El Forum - 07-31-2012 [eluser]Aken[/eluser] My guess is your ajax URL to POST to is wrong. Have you used Firebug or other Javascript console to see if there are any errors returned? They'll tell you if there's a 404 error or something with the ajax request. Validation Rules - El Forum - 07-31-2012 [eluser]xtremer360[/eluser] I do but I didn't get any that I saw Validation Rules - El Forum - 07-31-2012 [eluser]Aken[/eluser] I'd confirm that your POST request is going to the proper URL first, then debug from there. Validation Rules - El Forum - 08-01-2012 [eluser]xtremer360[/eluser] For some reason its still not validating. http://pastebin.com/YqUMuehU http://www.kansasoutlawwrestling.com/kowmanager/register Validation Rules - El Forum - 08-01-2012 [eluser]xtremer360[/eluser] Found the issue it was with the rule of the callback in the form validation. I needed email_address not just email. Validation Rules - El Forum - 08-01-2012 [eluser]CroNiX[/eluser] It seems to POST to /register/submit fine. In firebug, I receive the following response back from the server via ajax: Quote:<br /> If you are using firebug and examining the responses, how do you not see these errors? Also, you are still returning the string 'The form was not validated!' no matter what the errors are. It would be MUCH better to at least return the output of validation_errors() so that the user doesn't have to guess where on the form the problem is, even if they don't show up right next to each form field. Validation Rules - El Forum - 08-01-2012 [eluser]xtremer360[/eluser] Well CroNiX I added the validation errors like so: $output_array = array( 'error' => TRUE, 'message' => validation_errors() ); And this came up: Unable to access an error message corresponding to your field name. Unable to access an error message corresponding to your field name. Validation Rules - El Forum - 08-01-2012 [eluser]CroNiX[/eluser] That would go back to our discussion from yesterday where the error name must match the name of the callback function exactly. Code: public function _some_callback($var) function name is "_some_callback" error message set for "_some_callback" If these 2 names don't match exactly, you'll get the error you are because it won't be able to find the error message that goes to that validation rule... Validation Rules - El Forum - 08-01-2012 [eluser]xtremer360[/eluser] So I updated with this: Code: ublic function _email_address_exists($str) And still the same. |