ZF2-383: Allow setting not empty validator in InputFilter\Input

Description

I want to use custom messages for the NotEmpty validator and I want to be able to set an input as required. Unfortunately I cannot do both . I can get a custom NotEmpty message if I set required to false and allow_empty to true and then add a NotEmpty validator to the validator chain. But when I create my forms I want to be able to check if the field is required by calling $input->isRequired() and add an asterisk to the label if it is. However, if I set required to true Input::injectNotEmptyValidator() will add a NotEmpty validator. It would be nice if there were methods for Input::setNotEmptyValidator($validator) or Input::setNotEmptyMessage(array(NotEmpty::IS_EMPTY => 'custom message')). I think the setNotEmptyValidator() method would be better since it would allow you to use a custom validator.

Comments

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit: https://github.com/zendframework/zf2/issues/2496