Note that there are some explanatory texts on larger screens.

plurals
  1. POCustomizing Zend Framework 2 Email Field Validator Error Messages
    primarykey
    data
    text
    <p>I've got an Input Filter whose validator config for an email field looks like;</p> <pre><code>'validators' =&gt; array( array ( 'name' =&gt; 'EmailAddress', 'options' =&gt; array( 'messages' =&gt; array( 'emailAddressInvalidFormat' =&gt; "Email address doesn't appear to be valid.", ) ), ), array ( 'name' =&gt; 'NotEmpty', 'options' =&gt; array( 'messages' =&gt; array( 'isEmpty' =&gt; 'Email address is required', ) ), ), ), ), </code></pre> <p>It works, that part is fine, but what I will get forever laughed at by the business units here, is if I put out an app that spits this error message to users:</p> <p>The input does not match against pattern </p> <blockquote> <p>'/^[a-zA-Z0-9.!#$%&amp;'<em>+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)</em>$/'</p> </blockquote> <p>There's a strange nerd comedy buried in there (yes I realize it's accurate, but, rofl).</p> <p>I have two questions for the kind souls here:</p> <p><strong>How can I customize that error message?</strong> I can't seem to find the right key as I easily had for <code>'emailAddressInvalidFormat'</code>.</p> <p>Also, <strong>Is it possible to roll all the errors up into one?</strong> What I mean by that is. Rather than posting: </p> <blockquote> <p>"Your email pattern just left the building &amp; Your email cannot be blank &amp; Your email doesn't appear to be valid"</p> </blockquote> <p>Can I put a "single failure" message for email? </p> <blockquote> <p>"Hey bud, check your email, something ain't right!"</p> </blockquote> <p>Thanks for your help as always.</p> <p><strong>UPDATE</strong></p> <p>Vote for this bug here <a href="https://github.com/zendframework/zend-validator/issues/41" rel="nofollow">https://github.com/zendframework/zend-validator/issues/41</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload