Custom form validation callback error message not working right |
Validating a form, I have set-up a callback on a validation rule. The validation is working properly but for reasons not understood Codeigniter is not returning the error message set in the callback function. Here is the code:
The rule set in the Controller: PHP Code: $this->form_validation->set_rules('group_id', 'Group ID', 'callback_group_id_check'); The callback function: PHP Code: public function group_id_check($group_id) { I have run the code with and without a debugger. The syntax above runs without a problem. If I purposely set 'group_id' with a value that will trigger a false, Codeigniter returns an error message: "Unable to access an error message corresponding to your field name Group ID.(group_id_check)" I followed the tutorial within Form Validation documentation for CI 3.1.6 Can someone show what I am doing wrong?
It where I while since I tried this without "Callable: Use anything as a rule" functionality. But according to the manual you have named your message string incorrectly.
https://codeigniter.com/user_guide/libra...on-methods Code: $this->form_validation->set_message('group_id_check', 'Group id is not acceptable.');
Yes, indeed I have. Thanks for pointing that out. It is fixed and now working properly.
|
Welcome Guest, Not a member yet? Register Sign In |