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

Issue Type: Improvement Created: 2012-07-02T00:32:18.000+0000 Last Updated: 2012-10-08T20:15:10.000+0000 Status: Closed Fix version(s): Reporter: mark wright (maarky) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend\InputFilter

Related issues: Attachments:


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.


Posted by Ralph Schindler (ralph) on 2012-10-08T20:15:10.000+0000

This issue has been closed on Jira and moved to GitHub for issue tracking. To continue following the resolution of this issues, please visit:

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.