1 Reply Latest reply on Nov 14, 2007 11:56 AM by Arbi Sookazian

    a4j:support causing db table to update prematurely

    Arbi Sookazian Master

      I have the following code in a JSF facelet backed by a conversation scoped SFSB with an injected session scoped SFSB. This is a Seam2 web app with JBoss 4.2.1.GA. Immediately after I click 'yes' or 'no' on the radio button, I run a select on the DB table for the JPA entity that is in question and an update transaction has been committed. I don't want that to happen until the user clicks the submit button in the form (i.e. this is a premature update).

      When I removed the a4j:support tag, the update stopped happening. How can I fix this problem? I started commenting attributes (e.g. reRender) but that didn't help.

      Does the a4j:support tag always force the h:form to submit?? If so, what method will be called?

      <h:column>
       <f:facet name="header">Account Approved?</f:facet>
      
       <h:selectOneRadio id="accountApprovedRB" value="#{myRow[1].icomsAccountApproved}">
       <a4j:support event="onclick"
       oncomplete="showHideRadioButtons(#{myAuditList.getRowIndex()}); processNote(#{myAuditList.getRowIndex()}, 'accountApproved'); checkForSubmit(#{myAuditList.getRowIndex()})"
       action="#{noteAction.setRenderRadioButtons(myAuditList.getRowIndex(), myRow[1].icomsAccountApproved)}"
       ajaxSingle="true"/>
       <!-- reRender="mainForm" -->
      
      
       <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
       </h:selectOneRadio>
       <h:graphicImage id="acctGraphic" value="/img/icon_edit.gif"
       onclick="editNote(this, #{myAuditList.getRowIndex()}, 'accountApproved');" style="visibility:hidden"/>
       </h:column>


        • 1. Re: a4j:support causing db table to update prematurely
          Arbi Sookazian Master

          well I changed the PersistenceContextType from EXTENDED to default (transaction) on the main SFSB, and this issue went away. The other SFSB (noteAction) was default already.

          so not sure if it's related to the a4j:support tag anymore...

          I'd still like to know if the a4j:support tag submits the form and if so, what happens in terms of method(s) called on the SFSB. I know that ajaxSingle will only submit that component of the form and not the entire form.