3 Replies Latest reply on Jan 15, 2010 2:39 PM by aymenez

    Confirmation message does not work

    aymenez
      Hello,

      I want to show a confirmation message before executing the save action but the confirmation panel is well displayed but when i click on 'Confirmer', nothing happens.
      Please help me, i am in stuck
      this is my button to show to confirm

      <h:commandButton value="#{messages['fr.aptus.siaptus.user.save']}"
                                    onclick="#{rich:component('panel')}.show();return false; " />

      this modal panel is well displayed

      <f:subview>
                          <rich:modalPanel id="panel" width="350" height="100">
                               <f:facet name="header">
                                    <h:panelGroup>
                                         <h:outputText value="SIAPTUS V1.0"></h:outputText>
                                    </h:panelGroup>
                               </f:facet>
                               <h:outputText value="#{messages['fr.aptus.siaptus.msgConfirmSuppUtilisateur']}"></h:outputText>
                               <br/>
                               <center>
                               <div class="actionButtons">
                               <a4j:commandButton action="#{accountManagerBackingBean.save}" value="Confirmer" />
                               <h:commandButton value="Confirmer">
                                    <a4j:support event="onclick" ajaxSingle="true"
                                         action="#{accountManagerBackingBean.save()}" />
                               </h:commandButton>
                               <h:commandButton value="Annuler" onclick="#{rich:component('panel')}.hide();return false;"/>
                               </div>
                               </center>
                          </rich:modalPanel>
                     </f:subview>
        • 1. Re: Confirmation message does not work
          cilgamir

          Is anything written to your JBOSS log when you click the confirm button ?

          • 2. Re: Confirmation message does not work
            yahawari

            i am not sure what are u doing there, however, make sure u have h:form
            or a:form wrapping ur buttons.


            and if ur buttons are supposed to submit data (for saving for example), u need to make sure they are sumitted as well (which means ajaxSingle is not a the right thing to use on the save button)


            save urself the trouble and use confirm() javascript function :)


            • 3. Re: Confirmation message does not work
              aymenez
              This is all my page

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
              <ui:composition xmlns="http://www.w3.org/1999/xhtml"
                   xmlns:s="http://jboss.com/products/seam/taglib"
                   xmlns:ui="http://java.sun.com/jsf/facelets"
                   xmlns:f="http://java.sun.com/jsf/core"
                   xmlns:h="http://java.sun.com/jsf/html"
                   xmlns:rich="http://richfaces.org/rich"
                   xmlns:a4j="http://richfaces.org/a4j"
                   template="layout/GeneralTmpl.xhtml">

                   <ui:define name="WorkZone">
                        <h:form id="form">
                             <h:panelGroup>
                                  <h:commandButton value="#{messages['fr.aptus.siaptus.user.create']}"
                                       action="#{accountManagerBackingBean.create}" />
                                  <rich:extendedDataTable
                                       value="#{accountManagerBackingBean.accountsList}" var="user"
                                       id="table1" selectionMode="single"
                                       onselectionchange="#{accountManagerBackingBean.onSelectionChange}"
                                       selection="#{accountManagerBackingBean.selection}">
                                       <rich:column>
                                            <f:facet name="header">
                                                 <h:outputText
                                                      value="#{messages['fr.aptus.siaptus.user.identifier']}" />
                                            </f:facet>
                                            <h:outputText value="#{user.userName}" />
                                       </rich:column>
                                       <rich:column>
                                            <f:facet name="header">
                                                 <h:outputText value="#{messages['fr.aptus.siaptus.user.name']}" />
                                            </f:facet>
                                            <h:outputText value="#{user.collaborator.name}" />
                                       </rich:column>
                                       <rich:column>
                                            <f:facet name="header">
                                                 <h:outputText
                                                      value="#{messages['fr.aptus.siaptus.user.surname']}" />
                                            </f:facet>
                                            <h:outputText value="#{user.collaborator.surname}" />
                                       </rich:column>
                                       <f:facet name="footer">
                                            <rich:datascroller id="ds" renderIfSinglePage="false"></rich:datascroller>
                                       </f:facet>
                                       <a4j:support reRender="selectionPanel"
                                            action="#{accountManagerBackingBean.onSelectionChange}"
                                            event="onselectionchange" />
                                  </rich:extendedDataTable>

                                  <rich:panel id="selectionPanel"
                                       rendered="#{accountManagerBackingBean.renderDetail}">
                                       <f:facet name="header">
                                            <h:outputText value="#{messages['fr.aptus.siaptus.user.details']}" />
                                       </f:facet>
                                       <h:panelGrid columns="2" columnClasses="name,value">
                                            <h:outputText
                                                 value="#{messages['fr.aptus.siaptus.user.identifier']}" />
                                            <h:inputText value="#{selectedUser.userName}" />
                                            <h:outputText
                                                 value="#{messages['fr.aptus.siaptus.user.privileges']}" />
                                            <h:selectManyCheckbox
                                                 value="#{accountManagerBackingBean.privileges}">
                                                 <f:selectItems value="#{privilegeCheckboxItems}" />
                                            </h:selectManyCheckbox>
                                            <h:outputText value="#{messages['fr.aptus.siaptus.user.profile']}"
                                                 rendered="#{accountManagerBackingBean.mode=='INS'}" />
                                            <h:selectOneMenu value="#{accountManagerBackingBean.profile}"
                                                 rendered="#{accountManagerBackingBean.mode=='INS'}">
                                                 <f:selectItems value="#{profiles}" />
                                                 <a4j:support event="onchange" ajaxSingle="true"
                                                      reRender="checkboxPanel"
                                                      action="#{accountManagerBackingBean.onProfileChange}" />
                                            </h:selectOneMenu>
                                            <h:outputText
                                                 value="#{messages['fr.aptus.siaptus.user.collaborator']}"
                                                 rendered="#{accountManagerBackingBean.mode=='INS'}" />
                                            <h:selectOneMenu value="#{accountManagerBackingBean.collaborator}"
                                                 rendered="#{accountManagerBackingBean.mode=='INS'}">
                                                 <f:selectItems value="#{collaborators}" />
                                            </h:selectOneMenu>
                                       </h:panelGrid>
                                       <h:commandButton value="#{messages['fr.aptus.siaptus.user.save']}"
                                            onclick="#{rich:component('panel')}.show();return false; " />
                                       <h:commandButton
                                            value="#{messages['fr.aptus.siaptus.user.delete']}"
                                            action="#{accountManagerBackingBean.delete}" />
                                  </rich:panel>
                             </h:panelGroup>
                             <f:subview>
                                  <h:form >
                                  <rich:modalPanel id="panel" width="350" height="100">
                                       <f:facet name="header">
                                            <h:panelGroup>
                                                 <h:outputText value="SIAPTUS V1.0"></h:outputText>
                                            </h:panelGroup>
                                       </f:facet>
                                       <h:outputText value="#{messages['fr.aptus.siaptus.msgConfirmSuppUtilisateur']}"></h:outputText>
                                       <br/>
                                       <center>
                                       <div class="actionButtons">
                                       <h:commandButton action="#{accountManagerBackingBean.save}" value="Confirmer" />
                                       <h:commandButton value="Confirmer">
                                            <a4j:support event="onclick" action="#{accountManagerBackingBean.save()}" />
                                       </h:commandButton>
                                       <h:commandButton value="Annuler" onclick="#{rich:component('panel')}.hide();return false;"/>
                                       </div>
                                       </center>
                                  </rich:modalPanel>
                                  </h:form>
                             </f:subview>
                        </h:form>
                   </ui:define>

              </ui:composition>