Unable to access an error message corresponding to your field name. |
[eluser]php beginner[/eluser]
Unable to access an error message corresponding to your field name. this error occure while i use callback in rules
[eluser]adamp1[/eluser]
By the sounds of things you have done the following: Code: $this->form_validation->set_rules('myfield', 'My Field', 'callback_isvalid'); The issue is you are missing the following line from the callback method. Code: $this->form_validation->set_message('myfield', 'The %s field is invalid'); For more information please see this user guide section http://ellislab.com/codeigniter/user-gui...tingerrors
[eluser]theshiftexchange[/eluser]
[quote author="adamp1" date="1270641494"]By the sounds of things you have done the following: Code: $this->form_validation->set_rules('myfield', 'My Field', 'callback_isvalid'); The issue is you are missing the following line from the callback method. Code: $this->form_validation->set_message('myfield', 'The %s field is invalid'); Actually thats slightly wrong. It should be: Code: $this->form_validation->set_message ('isvalid', 'The %s field is invalid'); The $this->form_validation->set_message name needs to be the name of your callback function - NOT your variable name. If you set it to the variable name it gives the exact message the OP posted. I know this because 30mis ago I had EXACTLY the same problem on one of my forms and worked out I'd done this
[eluser]adamp1[/eluser]
@theshiftexchange: Yup your 100% correct, typo on my part. If thats not the fix could you post the code for setting up the validation rules and your callback method. |
Welcome Guest, Not a member yet? Register Sign In |