1 Reply Latest reply on Aug 14, 2009 6:30 PM by nbelaevski

    Problem re-rendering a region with a4j, input fields keep ol

      I have a master detail that can be compiled many times with two buttons: one to save infos, and one to undo the operation and close the panel without save it.
      With the commandLink "Insert new" I show the panel and the two buttons setting the variables rendoquadro=true and rendopulsanti=true.

      <a4j:commandLink value="Insert new" action="#{np_b.gestore_committenti.nuovo}" ajaxSingle="true" reRender="comm:quadro"/>
      
      <rich:spacer height="12px" />
      
      <f:subview id="comm">
       <a4j:outputPanel id="quadro">
       <rich:simpleTogglePanel switchType="client" rendered="#{np_b.first_committente.stato.rendoquadro}">
       <h:panelGrid columns="3" >
       <h:input id="denominazione" binding="#{np_b.first_committente.societa.denominazione}" required="true>
       </h:input>
       <h:input id="partitaiva" binding="#{np_b.first_committente.societa.partitaiva}" required="true">
       </h:input>
       <h:input id="codicefiscale" binding="#{np_b.first_committente.societa.codicefiscale}" required="true">
       </h:input>
       </h:panelGrid>
       </rich:simpleTogglePanel>
       </a4j:outputPanel>
      </f:subview>
      
      <h:panelGrid columns="2">
       <a4j:commandButton value="Undo" reRender="committentilist,comm:quadro"
       action="#{np_b.gestore_committenti.annulla}" rendered="#{np_b.first_committente.stato.rendopulsanti}"
       immediate="true" type="submit">
       </a4j:commandButton>
      
       <a4j:commandButton value="Save" reRender="committentilist,comm:quadro"
       action="#{np_b.gestore_committenti.salva}" rendered="#{np_b.first_committente.stato.rendopulsanti}"
       type="submit">
       </a4j:commandButton>
      </h:panelGrid>


      The problem is: if I press Insert New, compile some fields and then press Undo, the press Insert New again the input fields keep old inserted values when I want them to be blank. When I press Save or Undo the backing method creates a new object and assign it to the variable np_b.first_committente.
      With the Save button (without immediate attribute) everything is fine: if I press Insert New, compile fields, Save and then I click Insert New again all fields are blank; that not happens with undo, probably because of immediate attribute that is the only difference between the two buttons.
      How can I solve it?

      Thanks,

      Alessandro.