monkey-wrench
monkey-wrench

Reputation: 1616

JSF 2.0 Validation Summary Message

Using JSF 2.0 validation, is there a way to have a summary message on submit if there is an error (as well as keeping individual form element error messages)?

I have a large form so the problem I am encountering is that when the user clicks "SUBMIT" it will display the error information next to each individual form element but the user cannot easily tell that errors exist on the page.

Along the lines, what is the common or recommended practice?

Upvotes: 0

Views: 1834

Answers (2)

baba.kabira
baba.kabira

Reputation: 3171

I generally use

<h:messages>

at the top of the page along with label attribute of components to describe each component in error message.

link here and here might be useful

Upvotes: 0

BalusC
BalusC

Reputation: 1108537

How about this?

<h:outputText value="There are messages" rendered="#{not empty facesContext.messageList}" />

Alternatively you can also just use JavaScript to put focus on the first invalid input element. That's a more common practice.

Upvotes: 1

Related Questions