I have an Multiselect Zend Form element with many options. I have to validate the number of selected options (at least N options and at most M options are selected). I want the error message to be printed in the form just like regular Zend Validate error message.
What is the simplest (and the least hacky) way to do this?
A regular validator can't do this, because each selected value is validated completely individually.
I tried to override the form's isValid method and added the logic there (return false and add an error message if the number is outside the allowed range), but that results in the error message being printed multiple times (for each selected value). I feel that trying to fix this would result in extremely hacky code.
Thanks for help