1 Reply Latest reply on Jun 10, 2008 8:26 AM by ilya_shaikovsky

    Closing ModalPanel a4j:commandbutton with oncomplete not bin

    mbfrench

      Hi,

      I have a modal panel which use an a4j command button as below:

      <a4j:commandButton value="#{labels.addButton}" action="#{addAmendmentNumber.addAmendment}"
       oncomplete="Richfaces.hideModalPanel('amendmentNumberPopupFrm:amendmentNumberPopup');"/>
      


      The full jsp include is below:

      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      
      <f:loadBundle var="labels" basename="labels"/>
      
      <h:form id="amendmentNumberPopupFrm">
       <rich:modalPanel id="amendmentNumberPopup" width="400" height="400">
       <f:facet name="header">
       <h:outputText value="#{labels.addAmendmentNumber}"/>
       </f:facet>
      
       <h:panelGrid columns="1" styleClass="entryTable">
       <rich:scrollableDataTable id="amendmentNumberTbl" height="200px" width="95%" styleClass="resultsTable"
       sortMode="single" first="0" value="#{addAmendmentNumber.amendmentNumbers}"
       var="num" binding="#{addAmendmentNumber.table}"
       selection="#{addAmendmentNumber.selection}">
       <rich:column width="100">
       <f:facet name="header">
       <h:outputText value="#{labels.amendmentNo}"/>
       </f:facet>
       <h:outputText value="#{num.id}"/>
       </rich:column>
       <rich:column width="350">
       <f:facet name="header">
       <h:outputText value="#{labels.description}"/>
       </f:facet>
       <h:outputText value="#{num.description}"/>
       </rich:column>
       </rich:scrollableDataTable>
       <h:panelGrid columns="1" styleClass="textDisplayTable">
       <f:facet name="header">
       <h:outputLabel for="ammendmentDescription" value="#{labels.description}"/>
       </f:facet>
       <h:inputTextarea label="#{labels.description}" required="true" id="ammendmentDescription" rows="5"
       style="width:100%;" value="#{addAmendmentNumber.description}">
       <f:validateLength maximum="255"/>
       </h:inputTextarea>
       </h:panelGrid>
       <f:facet name="footer">
       <h:panelGroup>
       <a4j:commandButton value="#{labels.addButton}" action="#{addAmendmentNumber.addAmendment}"
       oncomplete="Richfaces.hideModalPanel('amendmentNumberPopupFrm:amendmentNumberPopup');"/>
       <rich:spacer/>
       <a4j:commandButton immediate="true" value="#{labels.closeButton}"
       onclick="javascript:Richfaces.hideModalPanel('amendmentNumberPopupFrm:amendmentNumberPopup');"/>
       </h:panelGroup>
       </f:facet>
       </h:panelGrid>
       </rich:modalPanel>
      </h:form>
      


      The problem I having is that the action is firing but the field values are not binding if I change this to onclick the form values are bound. Am I missing something? Any ideas on how to solve this issue as I need to trap validation errors.

      Cheers

      Mark