1 Reply Latest reply on Feb 13, 2009 2:55 PM by janakiram narla

    Clear rich:modalPanel data.

    Nagendra krishnawat Newbie

      Scenario is as follows
      I have a commandlink which is attached to a modal panel, In the modalPanel user creates a new "Mandate" and save, Modal panel have three text boxes, save button and cancel button. On the click of save button I persist the mandate object.
      "Mandate" object is saved to the database.


      Now when I again click the commandLink to create a new "Mandate" I cant do that, since the "mandate" object I saved previously is still in the manages state so the modalPanel show up the old values and not the clear text boxes( Which I want to create another mandate).


      Here is the code:



      <h:outputLink value="#" id="link">
                                      Create mandate instantly !
                                  <rich:componentControl for="panel" attachTo="link" operation="show" event="onclick"/>
                               </h:outputLink>   



      Modal Panel:


      <rich:modalPanel id="panel" width="450" height="210" shadowDepth="10" moveable="true" styleClass="modalStyle">
           <h:form id="modalForm">
           <rich:panel>
                <f:facet name="header">#{mandateHome.managed ? 'Edit' : 'Add'} Mandate</f:facet>
                 <s:decorate id="descriptionDecoration" template="../layout/edit.xhtml">
                      <ui:define name="label"><h:outputText value="#{messages['label.mandate.description']}"/></ui:define>
                      <h:inputText id="description"    value="#{mandateHome.instance.description}"/>
                  </s:decorate>
      
                  <s:decorate id="marketDecoration" template="../layout/edit.xhtml">
                      <ui:define name="label"> <h:outputText value="#{messages['label.mandate.market']}"/></ui:define>
                      <h:inputText id="market" value="#{mandateHome.instance.market}"/>
                  </s:decorate>
      
                  <s:decorate id="productDecoration" template="../layout/edit.xhtml">
                      <ui:define name="label">  <h:outputText value="#{messages['label.mandate.product']}"/></ui:define>
                    <h:inputText  id="product"  value="#{mandateHome.instance.product}"/>
                  </s:decorate>
      
                  <s:decorate id="vehicleDecoration" template="../layout/edit.xhtml">
                      <ui:define name="label">  <h:outputText value="#{messages['label.mandate.vehicle']}"/></ui:define>
                    <h:inputText  id="vehicle" value="#{mandateHome.instance.vehicle}"/>
                  </s:decorate>
              
                  <div style="clear:both">
                      <span class="required">*</span> 
                      required fields
                  </div>
                  
              </rich:panel>
                      
              <div class="actionButtons">
                     <h:commandButton id="save" 
                               value="#{messages['button.common.save']}"
                               action="#{mandateHome.persist}"
                             disabled="#{!mandateHome.wired}"/>
                            
                  <s:button id="done" value="#{messages['button.common.done']}"
                   propagation="end"
                          view="/portfolio/AccountEdit.xhtml"
                      rendered="#{mandateHome.managed}"/>
                      
                  <s:button id="cancel" 
                         value="Cancel"
                   propagation="end"
                          view="/portfolio/AccountEdit.xhtml"
                      rendered="#{!mandateHome.managed}"/>
      
              </div>
            </h:form>
          </rich:modalPanel>




      Help me to fix it, Thanks