I have a ZF2 form where I had to disable native validators, for a specific reason.
Then, when adding elements programatically to the form I also add validators.
Actually, following the bugfix link, I figured out how to do the validation. Explode validator would break down the value and apply a validator to each part:
if($f instanceof \Zend\Form\Element\Select){
$inputFilter->add($factory->createInput(array(
'name' => $f->getName(),
'required' => $f->getAttribute('required') == 1,
'validators' => array(
array(
'name' => 'Explode',
'options' => array(
'validator' => new InArray(array(
'haystack' => $f->getValueOptions(),
'valueDelimeter' => null,
'messages' => array(
InArray::NOT_IN_ARRAY => 'Please select an option',
),
))
)
),
),
)));
}
Leaving this question here, because I haven't found any other answers to this myself and hopefully this will assist people in the future.