CodeIgniter Forums
validation custom error not working in saved rules - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: validation custom error not working in saved rules (/showthread.php?tid=76594)



validation custom error not working in saved rules - nmaa3003 - 05-30-2020

PHP Code:
    //--------------------------------------------------------------------
    // Rules
    //--------------------------------------------------------------------
    
public $merchant_register = [
        
'email' => [
            
'label' => 'Email Address'
            
'rules' => 'trim|required|valid_email|is_unique[merchant.email]'
            
'errors' => [
                
'is_unique' => 'Your email address has been registered'
            
]
        ],
        
'password' => [
            
'label' => 'Password'
            
'rules' => 'trim|required|string|min_length[8]|max_length[30]'
        
],
        
'confirm_password' => [
            
'label' => 'Confirm Password'
            
'rules' => 'required|matches[password]'
        
],
        
'mobile' => [
            
'label' => 'Mobile No'
            
'rules' => 'trim|required|numeric|min_length[10]'
        
]
    ]; 

the default error was the one shows in the screen when i put existing email.
this is saved rule in :

PHP Code:
<?php namespace Config;

class Validation 

and run by this command which is working good. just the custom error not showing.


PHP Code:
$validation $data['validation']->run($input'merchant_register');