Is there a way of detaching a validator from an input? e.g.
$input->getValidatorChain()
->attach('email_address')
->attach('no_record_exists');
if($isExistingUser == true) {
$input->getValidatorChain()
->remove('no_record_exists');
}
$form->getInputFilter()->remove('no_record_exists');
Form being a Zend\Form\Form object
To disable e.g. the required-validation, you can do :
$form->getInputFilter()->get('form-field')->setRequired(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With