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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:55:30+00:00 2026-05-18T19:55:30+00:00

I have a form in which validation error message needs to be displayed below

  • 0

I have a form in which validation error message needs to be displayed below the input elements. The error needs to be highlighted by showing an error bubble around the error message and the input text.

To achieve this, I need to check for the existence of h:messages for individual elements.
I am able to check for the existence of global error messages as follows

<h:panelGroup rendered="#{not empty facesContext.messages}"> 
</h:panelGroup>

How I can check the same for specific client id (say first name). So something like

faceContent.messages("creditCardNo")

A solution I have currently is to create a custom resolver but was wondering if there is a better solution.

  • 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-18T19:55:31+00:00Added an answer on May 18, 2026 at 7:55 pm

    The error needs to be highlighted by showing an error bubble around the error message …

    Just use <h:message> with a styleclass wherein you define the desired style.

    <h:inputText id="foo" />
    <h:message for="foo" styleClass="error" />
    

    with

    .error {
        border: 1px solid red;
        background: pink;
    }
    

    …and the input text.

    Just check if UIInput#isValid() is true. Since JSF 2.0 the current component is available by implicit EL variable #{component}.

    <h:inputText styleClass="#{component.valid ? 'none' : 'error'}" />
    

    As to the actual question about checking if there’s a message for a certain client ID, then you may find this answer interesting. But I don’t think that this is applicable in your particular case.


    Update: as per the comments, you seem to want to style the containing component instead of the invididual components. In that case, do as follows:

    <h:panelGroup styleClass="#{foo.valid ? 'none' : 'error'}">
        <h:inputText id="foo" binding="#{foo}" />
        <h:message for="foo" />
    </h:panelGroup>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form in which validation error message needs to be displayed below
I am trying to place the error message elements outside the FORM element which
We have HTML form which will allow french alphabets. So we have added validation
When error message will come on validation if use have done something wrong then
I have a signup form on my home page which uses server side validation
I have a form which is used to insert/display and update . In the
I have a form which takes both the user details and an image uploaded
I have a form which has a lot of SELECTs. For various reasons, I'd
I have a form which I create manually (a lot of JavaScript in it...).
I have a form which users must fill out and submit. The controller action

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.