Form Validation Error |
[eluser]xtremer360[/eluser]
So that's all you suggest I do about this controller?>
[eluser]xtremer360[/eluser]
I ask because when I hit the submit button if it still doesn't pass validation rules then it displays the message "The form was not validated!" however its not displaying the errors for the corresponding issues of the form.
[eluser]CroNiX[/eluser]
Well, things like this are completely unnecessary and slows your app down, albeit by a very small amount. But still, pretty wasteful. Code: private function get_post( $post_var ) Line 122: Code: $user_data = As far as not showing the form/validation errors, it's because you aren't telling it too. You only tell it to show 'The form was not validated!' no matter what the errors are Line 163: Code: $output_array = array( In your callbacks, when setting the error messages, the error message name must match the callback function name exactly or it won't be able to match the error name to your rule. example: Code: public function email_address_exists($str) There might be more...
[eluser]xtremer360[/eluser]
So your saying for the first part I should be doing $this->input->post($post_var); where? you said directly but directly where. I took out that $user_data variable. The output_array with the validation_errors I want it to display the same as when js is enabled. Meaning under each form field. I also corrected this. $this->form_validation->set_message('email_address_exists', 'Testing2'); http://www.kansasoutlawwrestling.com/kow...r/register
[eluser]CroNiX[/eluser]
Quote:So your saying for the first part I should be doing $this->input->post($post_var); where? you said directly but directly where.Everywhere that you were previously using get_post($var) in. You don't have a search function in your IDE? I'm not a dentist and don't enjoy pulling teeth It looks like you are returning your data via JSON, so you won't be able to easily just display the individual error messages next to each form field unless you actually returned the just the form view portion with the errors parsed, and then replaced the existing form in the browser with the new one. That's pretty easy to do. There are other workarounds that can be done, but that would be the easiest.
[eluser]xtremer360[/eluser]
So your saying Code: $post_username = $this->get_post( 'username' ); should be Code: $post_username = $this->input->post($post_var); Something about that doesn't make sense to me.
[eluser]CroNiX[/eluser]
ok. Sorry I wasn't able to help. Maybe someone else can.
[eluser]xtremer360[/eluser]
[quote author="CroNiX" date="1343763018"] Quote:It looks like you are returning your data via JSON, so you won't be able to easily just display the individual error messages next to each form field unless you actually returned the just the form view portion with the errors parsed, and then replaced the existing form in the browser with the new one. That's pretty easy to do. There are other workarounds that can be done, but that would be the easiest. So your saying I need to return the form again at what point. I've never done this before and just trying to learn so that just in case the user has javascript disabled. |
Welcome Guest, Not a member yet? Register Sign In |