Codeigniter Validation error: "Unable to access an error message corresponding to your field name Captcha. (recaptcha)" Codeigniter Validation error: "Unable to access an error message corresponding to your field name Captcha. (recaptcha)" curl curl

Codeigniter Validation error: "Unable to access an error message corresponding to your field name Captcha. (recaptcha)"


“Unable to access an error message corresponding to your field name"

I guess Above error is shown when a field has no value and no required rule:

Try setting rule like below

$this->form_validation->set_rules('g-recaptcha-response', 'Captcha', 'required|callback_recaptcha');

OR ( For recent version of CI )

$this->form_validation->set_rules(        'g-recaptcha-response', /* Field */        'Captcha',              /* Label */         array(                 /* Rules */                'required',                array($this->your_model, 'recaptcha')              ));

OR

$this->form_validation->set_rules(        'g-recaptcha-response', /* Field */        'Captcha',              /* Label */         array(                 /* Rules */                'required',                array('my_recaptcha', array($this->your_model, 'recaptcha'))              ),        array(                 /* Error lists */              'my_recaptcha' => 'Invalid Recaptcha'             ));

See more here