Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

davidwindell commented Mar 26, 2013

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',
        )
    )
));
Owner

weierophinney commented Mar 28, 2013

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

Contributor

davidwindell commented Mar 28, 2013

👍

@weierophinney weierophinney added a commit that referenced this pull request Mar 28, 2013

@weierophinney weierophinney Merge branch 'hotfix/4117' into develop
Forward port #4117

Conflicts:
	tests/ZendTest/InputFilter/FactoryTest.php
41b800a

@ghost ghost assigned weierophinney Mar 28, 2013

@weierophinney weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015

@weierophinney weierophinney Merge branch 'hotfix/4117' bc78b89

@weierophinney weierophinney added a commit to zendframework/zend-inputfilter that referenced this pull request May 15, 2015

@weierophinney weierophinney Merge branch 'hotfix/4117' into develop
Forward port zendframework/zendframework#4117

Conflicts:
	tests/ZendTest/InputFilter/FactoryTest.php
06503d1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment