3 Replies Latest reply on Jan 14, 2010 5:30 PM by Ilya Dyoshin

    Cancel button with pop-up warning dialogue - navigation issues

    Ian Brewster Newbie

      I am new to Seam so please bear with me. I want to have a generic 'Cancel' button for my app which will firstly prompt the user with an 'Are you sure...' pop-up dialogue, and on OK should return to a specified page as a paramjeter. I can't get this to work - the pop-up dialogue is fine but I stay on the calling page. My code is as follows:


      Facelet button



      <!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:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:rich="http://richfaces.org/rich">
      
        <script type="text/javascript">
          function confirmCancel() {
            return confirm("#{commonText.cancelConfirmation}");
          }
        </script>
        <s:button id="cancel" 
                  view="#{nextView}" 
                  value="#{commonText.cancel}"
                  title="#{tooltip}" 
                  onclick="return confirmCancel()"/>
      </ui:composition>
      




      Calling page snippet




      <ui:include src="/layout/cancelButton.xhtml">
        <ui:param name="nextView" value="/useradmin/usermanager.xhtml"/>
        <ui:param name="tooltip" 
                  value="#{identityManager.userExists(userAction.username)
                         ? userText.quitEditUserTooltip 
                         : userText.quitNewUserTooltip}" />
      </ui:include>






      I'm obviously missing something so any help much appreciated!


      Thanks
      Ian