s:decorate looses form values on validation error
utiba_davidr Nov 29, 2007 8:52 PMHey All,
I have been trying to get this to work for the last two days, a little disconcerting. I am sure its something I have done wrong but im not sure what it is. When I use the s:decorate component to display an inline error message, upon displaying the inline error message correctly the forms value is suddenly cleared. Standard input components not wrapped inside a s:decorate do not exhibit this problem so I don't believe its related to page flow or scope, but im not certain what the issue is.
The xhtml page is as follows:
(NB: This isn't the desired form layout, this is an example to prove that s:decorate was the issue and that standard inputText / outputText in a panel worked fine)
<h:form id="registerAgentForm"> <rich:panel> <f:facet name="header">Register Agent</f:facet> <h:panelGrid columns="2" rowClasses="prop" columnClasses="name,value"> <h:column> <h:outputText value="Agent Reference:"/> </h:column> <h:column> <h:inputText id="agentref" value="#{agent.agentReference}" required="true"/> <s:decorate for="agentref" template="/WEB-INF/templates/layout/edit.xhtml"/> </h:column> <h:column> <h:outputText value="Name:"/> </h:column> <h:column> <h:inputText id="agentname" value="#{agent.name}" required="true"/> <s:decorate for="agentname" template="/WEB-INF/templates/layout/edit.xhtml"/> </h:column> </h:panelGrid> <s:decorate id="nicDecoration" template="/WEB-INF/templates/fragment/edit.xhtml"> <ui:define name="label">NIC:</ui:define> <h:inputText id="nic" value="#{agent.nic}" required="true"/> </s:decorate> <div style="clear:both"/> </rich:panel> <h:commandButton type="submit" value="Register" action="#{manageAgentAction.register}"/> </h:form>
The contents of edit.xhtml (pretty standard implementation) are as follows:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:s="http://jboss.com/products/seam/taglib"> <div class="prop"> <s:label styleClass="name #{invalid?'errors':''}"> <ui:insert name="label"/> <s:span styleClass="required" rendered="#{required}">*</s:span> </s:label> <span class="value #{invalid?'errors':''}"> <s:validateAll> <ui:insert/> </s:validateAll> </span> <s:message styleClass="error errors"/> </div> </ui:composition>
Thanks in advance!
David