How to hide message: The input was not found in the haystack in Zend Framework 2.5

Do you get this message "The input was not found in the haystack" in your Zend Framework form? A simple way to solve this error is to set the haystack for the validation in your form model.


$validator = new Zend\Validator\InArray(array('haystack' => array('value1', 'value2',...'valueN')));

You can also disable this validator. You can disable it by adding in your form model this code:

'disable_inarray_validator' => true

Your select box will be similar to this:

'type' => 'Zend\Form\Element\Select',
'name' => 'categories',
'attributes' => array(
'disable_inarray_validator' => true

Leave a Comment