08-31-2018, 07:09 PM
How do I set an error message for an anonymous function used to validate a field when using the form validation class?
Code:
Code:
PHP Code:
$this->form_validation->set_rules('referral-code', 'Referral Code',
array( 'required',
'regex_match[/^[a-zA-Z0-9]+$/]',
function($value){
// validation of code
}),
array('required'=>'Please enter a valid referral code',
'regex_match'=>'Invalid referral code',
'?? what goes here ??' => 'The code did not pass the test'
)
);