0 Replies Latest reply on Oct 7, 2008 6:26 PM by Val Sw

    How to clear form fields for same action

    Val Sw Expert
      I have a page reagent.xhtml, user fills some fields and clicks on button "Add More Reagents", I am storing the values in a list.
      As soon as user clicks "Add More Reagents" same form is loaded but the old values are still there in form fields.
      I can't use <render view-id="/reagent.xhtml"/> in the same navigation..

      Please suggest...

      reagent.xhtml
      -------------
      <s:decorate id="pnameDecoration" template="layout/edit.xhtml">
           <ui:define name="label">PName</ui:define>
           <h:inputText id="name" required="true" immediate="true"
                value="#{reagentHome.instance.pname}">
            </h:inputText>
      </s:decorate>   
      .......
      <div class="actionButtons">
          <h:commandButton id="addReagentAndTreatment"
                  value="Add More Reagents"
                 action="#{studyHome.addReagentAndTreatment}"
                  rendered="#{!reagentHome.managed}"/>
      </div>

      reagent.pages.xml
      -----------------
      <navigation from-action="#{studyHome.addReagentAndTreatment}">
        <rule if-outcome="addedReagentAndTreatment">                 
          <redirect view-id="/reagent.xhtml"/>
        </rule>
      </navigation>