Welcome Guest, Not a member yet? Register   Sign In
Form Validation - Error Message for Anonoymous Function
#2

You need to wrap it in another array and specify a message string name as the first parameter.
PHP Code:
$this->form_validation->set_rules(
        
'referral-code''Referral Code',
        array(
                
'required',
                
'regex_match[/^[a-zA-Z0-9]+$/]',
                array(
                        
'referral-code_callable',
                        function(
$str)
                        {
                                
// Check validity of $str and return TRUE or FALSE
                        
}
                )
        ),
        array(
                
'required'               =>'Please enter a valid referral code',
                
'regex_match'            =>'Invalid referral code',
                
'referral-code_callable' => 'The code did not pass the test'
        
)
); 
Reply


Messages In This Thread
RE: Form Validation - Error Message for Anonoymous Function - by jreklund - 09-01-2018, 01:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB