This content has been marked as final.
Show 2 replies
-
1. Re: seam don't set the invalid after an ajax request
pmuir Sep 26, 2007 7:33 AM (in response to wuhaixing)#{invalid} is made available by s:decorate - reRender the s:decorate, not its contents. Follow the examples!
-
2. Re: seam don't set the invalid after an ajax request
wuhaixing Sep 26, 2007 10:13 AM (in response to wuhaixing)thanks,I had figure it out.and there is the code can do it's work!
in the form:<s:decorate id="emailFormRow" template="/layout/formRow.xhtml"> <ui:define name="label"> <h:outputLabel for="email" value="#{messages['register.email']}"/> </ui:define> <ui:define name="field"> <h:inputText id="email" value="#{member.email}" required="true" onfocus="emailHelperShow({duration:0.5,from:0.0,to:1.0})" onblur="emailHelperHide({duration:0.7})"> <a4j:support event="onchange" reRender="emailFormRow" requestDelay="0" ajaxSingle="true"/> </h:inputText> </ui:define> <ui:param name="fieldId" value="email"/> <ui:param name="validateMessage" value="#{register.emailMessage}"/> <ui:param name="helperContent" value="tip.email"/> </s:decorate>
it's the template<a4j:region id="#{fieldId}Field" selfRendered="true" regionRenderOnly="true"> <a4j:outputPanel id="#{fieldId}Block" layout="block" styleClass="formRow"> <ui:insert/> <a4j:outputPanel id="#{fieldId}Label" layout="block" styleClass="formlabel #{invalid?'errlabel':''} #{required?'required':''}"> <ui:insert name="label"/> </a4j:outputPanel> <a4j:outputPanel id="#{fieldId}Input" layout="block" styleClass="formfield #{invalid?'flderr':''}"> <ui:insert name="field"/> <a4j:status for="#{fieldId}Field"> <f:facet name="start"> <h:graphicImage value="/img/icons/ajax_process.gif"/> </f:facet> </a4j:status> </a4j:outputPanel> <a4j:outputPanel id="#{fieldId}Helper" layout="block" rendered="#{not empty helperContent}" style="left:368px;display:none;" styleClass="helpMsg helperBlock" > <h:outputText escape="false" value="#{messages[helperContent]}"/> </a4j:outputPanel> <rich:effect name="#{fieldId}HelperHide" for="#{fieldId}Helper" type="Fade" rendered="#{not empty helperContent}"/> <rich:effect name="#{fieldId}HelperShow" for="#{fieldId}Helper" type="Appear" rendered="#{not empty helperContent}"/> <a4j:outputPanel id="#{fieldId}MessageBlock" layout="block" styleClass="errorMsg" ajaxRendered="true" rendered="#{invalid}"> <s:message for="#{fieldId}" globalOnly="false"/> </a4j:outputPanel> </a4j:outputPanel> </a4j:region>
I also replace div with outputPanel,put the region as the wrapper to keep the style