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:
or passing option to an element:
If you don't need validation at all, add
required => false
in InputFilterworked for me..
I found this at this link and thought I would post it as I found it a great solution .... http://samsonasik.wordpress.com/2012/10/01/zend-framework-2-extending-zendform-to-add-select-multicheckbox-emaildate-textarea-and-radio-element/
don’t try to deactive the default validator. re-values the select options values before setData.
Saves the mess of deactivating the function if you need it elsewhere
I came with the same case : while i was populating my html select element via ajax after alot of searching found no way to do it , ending with creating my own select form element , I will provide you with my changes :
I had the same problem and what i did is populate the element before validate it, for example:
This don't disable notInArray valitador but you can trick it.