Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4627308
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:32:58+00:00 2026-05-22T03:32:58+00:00

I have the next element: $email = new Zend_Form_Element_Text(’email’); $email->setAttribs(array(‘class’ => ‘input-text’, ‘id’ =>

  • 0

I have the next element:

$email = new Zend_Form_Element_Text('email');
$email->setAttribs(array('class' => 'input-text', 'id' => 'email'))
        ->setLabel($this->view->translate('Email'))
        ->setValue(null)
        ->setRequired(true)
        ->addValidator(new Zend_Validate_EmailAddress())
        ->setDecorators($emailMessageDecorators);

If there are more than one mistake in the email address, some errors are displaying. Like this:

'fff.fgdf' is no valid hostname for email address 'as@fff.fgdf'
'fff.fgdf' appears to be a DNS hostname but cannot match TLD against known list
'fff.fgdf' appears to be a local network name but local network names are not allowed

How can I set only 1 message? I have tryed setMessage(string), but it shows 3 same errors. Thanks. Sorry for my english. Peace & love)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:32:58+00:00Added an answer on May 22, 2026 at 3:32 am

    In the past, I had to make a custom validator for that:

    /**
     * The standard email address validator with a single, simple message
     */
    class App_Validate_EmailAddressSimpleMessage extends Zend_Validate_EmailAddress
    {
        const COMMON_MESSAGE = 'Invalid email address';
    
        protected $_messageTemplates = array(
            self::INVALID            => self::COMMON_MESSAGE,
            self::INVALID_FORMAT     => self::COMMON_MESSAGE,
            self::INVALID_HOSTNAME   => self::COMMON_MESSAGE,
            self::INVALID_MX_RECORD  => self::COMMON_MESSAGE,
            self::INVALID_SEGMENT    => self::COMMON_MESSAGE,
            self::DOT_ATOM           => self::COMMON_MESSAGE,
            self::QUOTED_STRING      => self::COMMON_MESSAGE,
            self::INVALID_LOCAL_PART => self::COMMON_MESSAGE,
            self::LENGTH_EXCEEDED    => self::COMMON_MESSAGE,
        );
    
    }
    

    Then called using:

    $email->addValidator(new App_Validate_EmailAddressSimpleMessage());

    If you just want to use the same syntax as usual:

    $email->addValidator('EmailAddress');

    but have it use this validator, then you can change the classname/filename from EmailAddressSimpleMessage to simply EmailAddress and register the prefix App_Validate_ with the form/elements.

    Even better would probably be to allow this class to accept an optional constructor parameter for the message you want, but I was going quick-and-dirty at the time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the next input element: <input type=text name=username id=username value=user name helper=formText defvalue=user
I have the next C# code: Dictionary<string, int> d = new Dictionary<string, int>(); d.Add(a,
I have found this example on StackOverflow: var people = new List<Person> { new
I'm going to start of by noting that I have next to no python
I have the next function: function setImagesWidth(id,width) { var images = document.getElementById(id).getElementsByTagName(img); for(var i
In my fieldset I have labels next (side) to my textboxes, but for some
How could I best implement the following scenario? I have a Next Period... button
I have First/Last/Previous/Next buttons that change the selected child node of a TreeViewItem. Setting
I have heard that closures could be introduced in the next Java standard that
I have the following code: if ($_POST['submit'] == Next) { foreach($_POST['info'] as $key =>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.