Welcome Guest, Not a member yet? Register   Sign In
Validation tutorial
#8

That's because you are using it wrong. If you are referring to $this->validate().
The tutorial command are a complete solution, you have created a three step process. Please refer to the post I made earlier, I copied the complete source code for it. You have created all those steps it does separately.

You are supposed to use it like this:

PHP Code:
$rules = [
    
'site_admin_name'               => 'min_length[3]|max_lenght[250]',
    
'site_admin_email'              => 'min_length[3]|max_length[250]|valid_email',
    
'site_admin_pass_curr'          => 'required_without[site_admin_pass_new,site_admin_pass_new_retype]',
    
'site_admin_pass_new'           => 'min_length[8]',
    
'site_admin_pass_new_retype'    => 'matches[site_admin_pass_new]',
    
'site_name'                     => 'max_length[200]',
    
'site_description'              => 'min_length[3]',
    
'site_keywords'                 => 'min_length[3]',
    
'u_c_reason'                    => 'min_length[3]',
    
'u_c_more_infos'                => 'min_length[3]',
];

if(
    
$this->request->getMethod() === 'get' ||
    ! 
$this->validate($rules)
)
{
    
// ...
}
else
{
    
// ...

Reply


Messages In This Thread
Validation tutorial - by Codinglander - 04-22-2020, 10:48 PM
RE: Validation tutorial - by Leo - 04-23-2020, 02:51 AM
RE: Validation tutorial - by Codinglander - 04-23-2020, 03:17 AM
RE: Validation tutorial - by jreklund - 04-23-2020, 11:31 AM
RE: Validation tutorial - by Codinglander - 04-23-2020, 07:49 PM
RE: Validation tutorial - by jreklund - 04-24-2020, 09:40 AM
RE: Validation tutorial - by Codinglander - 04-24-2020, 11:12 AM
RE: Validation tutorial - by jreklund - 04-24-2020, 11:21 AM
RE: Validation tutorial - by hugoafr - 07-01-2020, 01:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB