Is there way to validate form with conditions? I know I could add a custom valiadator, but I wonder if there is other ways
//* password $password = new Password('password', ['autocomplete'=>"off",'placeholder'=>'Password']); $password->addValidators(array( new StringLength(array( 'min' => 8, 'messageMinimum' => 'Password is too short. Minimum 8 characters' )), )); $this->add($password);
This is the part of form I used to validate password, I also use it on edit password page, so empty password will be allowed that means user is intend to the password.
is there anything I can use to trigger the validate only when password is not empty?