
When using Zend_Form’s multi-select with dynamically set options you need to make sure to update your options and the InArray validator accordingly when validating data using form->isValid().
In order to update selection options and update the InArray validator we need to first set the options, remove the currently set InArray validator and set it with the desired valid options, as shown below:
$options = array(); // ... $selectElement ->setMultiOptions($options) ->removeValidator('InArray') ->addValidator(new Zend_Validate_InArray(array_keys($options)));
That’it it.