I've the following form validation running;
$this->form_validation->set_rules('pricing_group', 'Pricing Group', 'callback_pricing_group');
with the callback function:
public function pricing_group($pricing_group) {
if ($pricing_group > 0) {
return true;
} else {
$this->form_validation->set_message('pricing_group', 'Invalid Price Group Specified.');
return false;
}
}
This is returning with the error:
"pricing_group":"Unable to access an error message corresponding to your field name Pricing Group.(pricing_group)"
I have also attempted to place the set_message function before the true/false checks took place. Note that the logic right now (just checking if it's greater than zero) is not anything like the intended final logic - it's just a basic example I'm putting in place to try and find out what the problem is.
Can anyone spot if I'm making some stupid mistake here? The only difference between this and my using the callback function before, is that this form validation is taking place within a model (as it'll be checking this value against the db), rather than within a controller. If I remove the callback_pricing_group
rule and swap it to something like "numeric
", it works fine.