-
1. Re: Changing label style of h:outputText through validation
ilya_shaikovsky Apr 5, 2010 3:59 AM (in response to g4j)if you using Seam - you could easilly achieve that with s:decorate. http://seamframework.org/Community/SdecorateWithA4jsupportInvalidAndRequiredContextVariablesNotSet
-
2. Re: Changing label style of h:outputText through validation
g4j Apr 5, 2010 11:44 AM (in response to ilya_shaikovsky)Thank you Ilya. I've read the post, but seam doesn't solve my problem at this time. Does anyone have any idea how I do it? Or doesn't is possible using only richafaces?
tks.
-
4. Re: Changing label style of h:outputText through validation
g4j Apr 6, 2010 8:19 AM (in response to m.a.g)I'll not use seam. There are on richfaces the same funcionality like <s:decorate /> ?
-
5. Re: Changing label style of h:outputText through validation
ilya_shaikovsky Apr 6, 2010 8:49 AM (in response to g4j)Then you should write that functionality on your own by getting information about validation errors from facesContext and addition of needed classes to components where it failed.
-
6. Re: Changing label style of h:outputText through validation
g4j Apr 6, 2010 9:20 AM (in response to ilya_shaikovsky)Hmmm.. Do you mean create this on each bean of my application? I don't understand. Can you explain this with any code?
Thanks in advance!
-
7. Re: Changing label style of h:outputText through validation
m.a.g Apr 6, 2010 9:29 AM (in response to g4j)If you are able to use JBossEL, you can try something like this:
<h:outputText value="#{foo}" id="fooId" style="#{facesContext.getMessages('barId').hasNext ? 'error' : '' " />
<h:inputText value="#{bar}" id="barId" required="true"/> -
8. Re: Changing label style of h:outputText through validation
g4j Apr 6, 2010 9:51 AM (in response to m.a.g)Thanks Denis. It sounds good idea. I going to test this.
-
9. Re: Changing label style of h:outputText through validation
g4j Apr 30, 2010 8:33 AM (in response to m.a.g)Denis Petrunin wrote:
If you are able to use JBossEL, you can try something like this:
<h:outputText value="#{foo}" id="fooId" style="#{facesContext.getMessages('barId').hasNext ? 'error' : '' " />
<h:inputText value="#{bar}" id="barId" required="true"/>Hello,
I've used this solution, and it works fine.
My code was very similar:
id="label1" style="#{facesContext.getMessages('formNew:txShortName1').hasNext() ? 'color:red' : ''}"
and i add <a4j:support on commandLink to make reRender on the component label1:
<a4j:commandButton value="#{msg['button.bt_Generic_confirm']}" action="#{countryMBean.save}">
<a4j:support event="oncomplete" reRender="label1"/>
</a4j:commandButton>it works!