Is there a way to validate an instance of Zend\Form\Element\MultiCheckbox
using the Zend validators such as Zend\Validator\Digits
?
I'm finding the existing Zend validators do not account for the fact that the selected value(s) is an array.
I found a reference here (http://zf2.readthedocs.io/en/release-2.2.7/modules/zend.form.element.multicheckbox.html) that the FormMultiCheckbox
helper (https://framework.zend.com/manual/2.4/en/modules/zend.form.view.helper.form-multicheckbox.html) can be used to add an InArray
validator to the element, but I'm not sure how that helps other types of validators. My usages show that it doesn't.
I realize I can extend the Zend Validators to account for the array, but I feel there has to be a way to do this which works with the rest of ZF2 out-of-the-box. If there isn't a way then I'll extend the validators, but I much rather use the out-of-the-box validators whenever possible.
Using:
zendframework/zend-form: 2.10.2
zendframework/zend-validator: 2.10.1