Unable to access an error message corresponding to your field name

$this->form_validation->set_message('check_captcha', 'text dont match captcha');

The message name corresponds to the function, not the field. So setting it to "check_captcha" will fix your bug. The error message will use the correct field name.


You can set error message in set_rules :

$this->form_validation->set_rules('captcha', 'Captcha', 'callback_check_captcha',

array('check_captcha' => 'text dont match captcha'));


Actually the best way, instead of write the error message directly on controller, would be add this entry "check_captcha" on languages.

In my case, the message for validation rule (form validation) "less_than" was not present.

I changed the file /system/language/??/form_validation_lang.php. I've added the missing entry.


That helped me

go to application/config/autoload.php and add "Security" helper class there.

$autoload['helper'] = array('security');

Or add this before your form validation

$this->load->helper('security');