How can I display validation error messages in JSF and Richfaces in the form of an icon beside the field and a tooltip with the error message appears when the mouse hover on the error icon ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
Here is what you can do:
<h:message tooltip="true" showSummary="true" showDetail="true" for=... />: this way the detail will appear as tooltip, hide the summary, replace it with an icon (see how).<rich:panel id="myid" rendered="#{bean.errorDisplayed}"><h:graphicImage src"patho/to/image.png" /></rich:panel>, create the tooltip<rich:toolTip for="myid"><h:message for="inputid" /></rich:toolTip>, in the backingbean use FacesContext.getMessages(String clientId) to check form messages. To get the clientId of the input use UIComponentBase.getClientIdh:message, and do some js tricks to wrap the displayed message in a tooltip, and display an icon (all of the js libraries have tooltip plugins).