Skip to main content

conditional styleClass value

2 replies [Last post]
rmerico
Offline
Joined: 2010-02-17
Points: 0

Dear Community

I'm using JSF 2.0 within Glassfish V3 and I have the following question.
Is there any possibility to set the styleClass of an h:inputText depending on if there is a validation error (a h:message) for this input field?

Many thanks in advance ... Raffaele

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rogerk
Offline
Joined: 2004-05-06
Points: 0

You should be able to set it dynamically in, for example your validation bean by obtaining the component instance, and setting that components attribute accordingly. This can be done in Java code.

rmerico
Offline
Joined: 2010-02-17
Points: 0

OK, thanks, but it's not exactly what I'm looking for.
I’m looking for a way to set the styleClass of an IO field when any standard validation or conversion methods failed.
There are many standard validation methods like required="true", or @NotNull that do not involve an own validation bean.
I'm asking myself if there is any EL construct to find out if there is any error set for a specific IO field.