ZF2 Remove Validator from ValidatorChain

Is there a way to separate the validator from the input? eg.

$input->getValidatorChain() ->attach('email_address') ->attach('no_record_exists'); if($isExistingUser == true) { $input->getValidatorChain() ->remove('no_record_exists'); } 
+4
source share
2 answers
 $form->getInputFilter()->remove('no_record_exists'); 

The form is a Zend \ Form \ Form object.

+2
source

To disable, for example. necessary check, you can do:

$ form-> getInputFilter () → get ('field form') → setRequired (false);

+2
source

Source: https://habr.com/ru/post/1485630/


All Articles