Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

[InputFilter] Allow specification of error message via Factory #4117

Conversation

davidwindell
Copy link
Contributor

One might want to stop the 'Email' validator (for example) from returning all of the multiple errors about hostname, parts, etc. This is already supported by \Zend\InputFilter\Input via the setErrorMessage() method.

This PR simply adds the ability to specify this via the factory as error_message.

$this->add(array(
    'name' => 'email',
    'required' => false,
    'error_message' => 'This is not a valid email address',
    'validators' => array(
        array(
            'name' => 'EmailAddress',
        )
    )
));

@weierophinney
Copy link
Member

Since this is simply exposing an existing setter via an option, I'm going to cherry-pick it to master as well.

@davidwindell
Copy link
Contributor Author

👍

weierophinney added a commit that referenced this pull request Mar 28, 2013
Forward port #4117

Conflicts:
	tests/ZendTest/InputFilter/FactoryTest.php
@ghost ghost assigned weierophinney Mar 28, 2013
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015
Forward port zendframework/zendframework#4117

Conflicts:
	tests/ZendTest/InputFilter/FactoryTest.php
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants