clear modalPanel form
swenvogel Jan 20, 2009 1:09 PMHi!
I am new to richfaces and I have a problem with the modalPanel.
The task is really simple, i want to submit a form from a modal panel to create a new user databse record.
The inputText controlls are bound to a seam component in event scope (eventUser).
Everything works fine whren i create the first user, but when i create a seccond user
and reopen the modalPanel the h:inputText controlls are showing the values from the previus user.
I want a clean form everytime i open the modal panel.
Here is the facelets xhtml code (i think the java code is not importent):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" template="layout/template.xhtml"> <ui:define name="main_content"> <rich:modalPanel id="panel" width="350" height="100"> <f:facet name="header"> <h:panelGroup> <h:outputText value="Create new user"></h:outputText> </h:panelGroup> </f:facet> <f:facet name="controls"> <h:panelGroup> <h:graphicImage value="/img/close.png" styleClass="hidelink" id="hidelink"/> <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/> </h:panelGroup> </f:facet> <div> <h:form> <s:decorate template="layout/edit.xhtml"> <ui:define name="label">Name</ui:define> <h:inputText required="true" value="#{eventUser.name}" /> </s:decorate> <s:decorate template="layout/edit.xhtml"> <ui:define name="label">Password</ui:define> <h:inputText required="true" value="#{eventUser.password}" /> </s:decorate> <h:commandButton action="#{account.addUser(eventUser)}" value="Save" /> </h:form> </div> </rich:modalPanel> <rich:tabPanel style="height: 400px;"> <rich:tab label="Common"> ... </rich:tab> <rich:tab label="Users"> <h:outputText value="No users exists." rendered="#{empty account.users}"/> <rich:dataTable var="user" value="#{account.users}" rendered="#{not empty account.users}"> <rich:column> <f:facet name="header">Name</f:facet> #{user.name} </rich:column> </rich:dataTable> <div> <h:outputLink value="#" id="link"> Create User <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/> </h:outputLink> </div> </rich:tab> </ui:composition>
When i change the tab from user to common an back everything works fine.