Is there a way to disable notInArray Validator in Zend Framework 2. All the info on the internet shows how to disable the notInArray Validator in Zend Framework 1, for example in this fashion
If you do not want the InArray validator at all, you can disable this behavior by either calling setRegisterInArrayValidator(false) on the element, or by passing false to the registerInArrayValidator configuration key on element creation.
One the posts in stackoverflow can be found here
Unfortunately this is not possible in Zend Framework 2. So in case if anybody has a tip how this can be disabled.
Since version 2.2, Zend Framework provide the ability to disable inArray validator calling:
$element->setDisableInArrayValidator(false);
or passing option to an element:
'disable_inarray_validator' => false
I had the same problem and what i did is populate the element before validate it, for example:
$clientForm->get('city')->setValueOptions($options);
$clientForm->setData($post);
if ($clientForm->isValid()) {
//
} else {
//
}
This don't disable notInArray valitador but you can trick it.
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