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 8861867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:35:21+00:00 2026-06-14T15:35:21+00:00

When the email address is invalid the message displayed is Invalid email.Invalid email.. I

  • 0

When the email address is invalid the message displayed is “Invalid email.Invalid email.”. I know that the message has two parts: summary and a details. I need both of these, but I want to have different info in each. How can I change the message to display “Invalid email: Please enter a valid email address” instead?

<p:messages showDetail="true" autoUpdate="true" closable="true" />
<h:panelGrid columns="2">
    <h:outputText value="#{label.email}: *" />
    <p:inputText required="true" value="#{userWizard.emailAddress}"
        validatorMessage="#{label.invalidEmail}" label="#{label.email}">
        <f:validateRegex pattern="^[_A-Za-z0-9-\+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$">
        </f:validateRegex>
    </p:inputText>
</h:panelGrid>  
  • 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-06-14T15:35:22+00:00Added an answer on June 14, 2026 at 3:35 pm

    This is not possible with validatorMessage (neither converterMessage nor requiredMessage). The value will be used as both the summary and the detail.

    You’d need to homegrow a custom validator instead wherein you can construct the FacesMessage with the both parts yourself. Assuming that you’ve next to the label.email also a label.email_detail which represents the message detail, then it should look something like this:

    @FacesValidator("emailValidator")
    public class EmailValidator implements Validator {
    
        private static final Pattern PATTERN = Pattern.compile("([^.@]+)(\\.[^.@]+)*@([^.@]+\\.)+([^.@]+)");
    
        @Override
        public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
            if (value == null || ((String) value).isEmpty()) {
                return; // Let required="true" handle.
            }
    
            if (!PATTERN.matcher((String) value).matches()) {
                String summary = context.getApplication().evaluateExpressionGet(context, "#{label.email}", String.class);
                String detail = context.getApplication().evaluateExpressionGet(context, "#{label.email_detail}", String.class);
                throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, summary, detail));
            }
        }
    
    }
    

    (note that I adapted the email regexp for better preparation on world domination; non-latin characters like Chinese, Hebrew, Cyrillic, etc are namely allowed in domain names and thus also email addresses since the new IANA decision in 2010)

    which is then to be used as

    <p:inputText ... validator="emailValidator" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that has duplicate email address, I need to insert just
Im working with email address which has an ampersand in it, the user wants
Possible Duplicate: Check that an email address is valid on iOS What is the
I have one contact form, that send the email to one of Address selected
Possible Duplicate: Validate email address in Javascript? I have an HTML form that uses
I'm building an app that has the ability to send info in an email.
Given an eMail address, I am trying to determine if it is a valid
I tried to control email address and reviewer's name with the following code but
I am passing the email address as part of the url, for ex. http://example.com/hello/user@hotmail.com
I want to receive email to my email address through my asp.net application. Its

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.