Submiting JSF form on clicking ok of Confirm dialog box

Hi,
We are using JSF 1.2 and Seam 2 in our project.
We have set of requirements
1)To throw a confirmation dialog box when user tries to navigate away from page with out saving the data changes. It includes browser closure, back button and refresh as well along with other application navigation links.
2) upon clicking ok we need to save the current JSF form and redirect to where user is intended to navigate.
Please let me know the best ways of implementing the above requirements.

For the first point, I totally agree with Raymond and you can use the javascript function like this:
<script>
window.onbeforeunload =
function(){
if((window.event.clientX<0) || (window.event.clientY<0)){
//create new confirm window here
//I guess you can check on opening a new JSF page itself as a pop up.
//in that page with normal form and submit buttons, I guess you can call JSF action methods.
</script>

Similar Messages

  • Confirmation dialog box in JSf

    Hi,
    I have a Save (type 'Submit') button which onClick should give me a confirmation dialog box with Ok and Cancel.
    Ok would go ahead with the process and cancel would take me back to where the page was before the save button was clicked.
    Any help is really appreciated.
    Thanks.

    Hello,
    I hope you can invoke a javascript function when the user clicks on "Save" button (onClick event for save button). Specify window.confirm(....) inside your javascript function which will give you confirmation window. I am not well enough how you want to handle navigation in your page.

  • Confirmation Dialog Box Appears Disappears

    Hi,
    I am facing a problem here on Same os win 98 using different versions of Java run time environment.
    The code is supposed to work in this way.
    Applet is initiated by a click. a confirmation dialog box appears askign for input from a user in the form of a Yes or a No. if the user clicks Yes the applet continues otherwise it terminates.
    while using 1.4.1_02 This problem occurs that the Confirmation dialog box appears and then disappears for the jar is being downloaded.
    But using 1.3.1_04 gives no problems and the Confirmation box does not disappear.
    Regards,
    Saurabh

    Hmmm, are you running 10.6.8 or later & installed the Security updates?
    Java was an attack vector for FlashBack.
    Disable Java in your Browser settings, not JavaScript.
    http://support.apple.com/kb/HT5241?viewlocale=en_US
    http://support.google.com/chrome/bin/answer.py?hl=en-GB&answer=142064
    http://support.mozilla.org/en-US/kb/How%20to%20turn%20off%20Java%20applets
    Flashback - Detect and remove the uprising Mac OS X Trojan...
    http://www.mac-and-i.net/2012/04/flashback-detect-and-remove-uprising.html
    In order to avoid detection, the installer will first look for the presence of some antivirus tools and other utilities that might be present on a power user's system, which according to F-Secure include the following:
    /Library/Little Snitch
    /Developer/Applications/Xcode.app/Contents/MacOS/Xcode
    /Applications/VirusBarrier X6.app
    /Applications/iAntiVirus/iAntiVirus.app
    /Applications/avast!.app
    /Applications/ClamXav.app
    /Applications/HTTPScoop.app
    /Applications/Packet Peeper.app
    If these tools are found, then the malware deletes itself in an attempt to prevent detection by those who have the means and capability to do so. Many malware programs use this behavior, as was seen in others such as the Tsunami malware bot.
    http://reviews.cnet.com/8301-13727_7-57410096-263/how-to-remove-the-flashback-ma lware-from-os-x/
    http://x704.net/bbs/viewtopic.php?f=8&t=5844&p=70660#p70660
    The most current flashback removal instructions are F-Secure's Trojan-Downloader:OSX/Flashback.K.
    https://www.securelist.com/en/blog/208193454/Flashfake_Removal_Tool_and_online_c hecking_site
    More bad news...
    https://www.securelist.com/en/blog/208193467/SabPub_Mac_OS_X_Backdoor_Java_Explo its_Targeted_Attacks_and_Possible_APT_link

  • Logout confirmation dialog box

    Hi,
    Kindly provide me some sample example for showing confirmation dialog box in ADF (jspx page) on click of of a RichCommandImageLink?
    Thnx,
    Vikas

    Here we go:
    Code for the command button
                      <af:commandButton text="Logout" id="cb2">
                        <af:showPopupBehavior popupId="p1" triggerType="action"/>
                      </af:commandButton>
                      <af:popup id="p1">
                        <af:dialog id="d2" dialogListener="#{LoginLogout.dialogLogoutListener}">
                          <af:outputText value="logout?" id="ot2"/>
                        </af:dialog>
                      </af:popup>In a managed bead (here called LoginLogout) implement the dialog listener and navigation if the user really wants to logout
        public String logoutTarget(String aTarget)
            ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
            HttpServletResponse response = (HttpServletResponse) ectx.getResponse();
            String url = ectx.getRequestContextPath() + aTarget;
            HttpSession session = (HttpSession) ectx.getSession(false);
            session.invalidate();
            try
                response.sendRedirect(url);
                FacesContext.getCurrentInstance().responseComplete();
            catch (IOException e)
                e.printStackTrace();
            return null;
        public void dialogLogoutListener(DialogEvent dialogEvent)
            if (dialogEvent.getOutcome() == DialogEvent.Outcome.ok)
              logoutTarget("/byby.html");
        }The method logoutTarget(String aTarget) does the navigation to a target which is given as parameter. This method is called by the dialogListener if the use clicks ok. In case the user closes the dialog or clicks cancel, the dialog listener is NOT called at all.
    We use a normal html page as target of the logout because using a jspx page causing trouble sometimes. The session gets invalidated in the bean, but the URL still contains the old session info in the url, resulting in some side effects.
    Timo

  • Displaying Multiple Sentences in Confirmation Dialog Box

    Hi Experts,
    Can anybody please tell me how to display three or multiple separate sentences in a Confirmation
    Dialog box. I am able to diaplay two sentences in a single line but the dialog box is getting stretched a
    lot. So i want to diaply them in separate sentences onr below the other.
    Thanks a lot.

    Hi shrini...
                   you want to number of line display in one dialog box ..
                  you have to declare one Strinh like thiss as below..
    have to create one event method as OK...which is visible in eventhandler code as
    findInEventHandlers("OK");
    create one method in component aas showBox....
    public void showBox( )
        //@@begin showBox()
         String   dialogText="welocme to""\n""India""\n".........................
          IWDEventHandlerInfo info=wdControllerAPI.getControllerInfo().findInEventHandlers("OK");
         IWDConfirmationDialog win=wdComponentAPI.getWindowManager().createConfirmationWindow(dialogText,info,"OKK");
      win.open();();
    thanks
    jati

  • File download element in confirmation dialog box

    Hi,
    Can I use File Download elements in Confirmation Dialog Box?Please raply me as early as possible.
    Regards
    Aniruddha

    Hi
    You can not use  File-Upload UI element inside confirmation dialog ,because there is no provision to add any UI ,except Button.
    Please avoid  my previous reply .
    Best Regards
    Satish Kumar
    Edited by: satish jhariya on Mar 3, 2009 11:29 AM

  • Multiple Confirmation dialog boxes event handling

    Hi all,
    I had a scenario, where i need to display two confirmation dialog boxes based on timers.
    At the first timers timeout confirmation dialog box poped up and user haven't done anything.
    second confirmation dialog popup appears after second timer timeout.
    But, my problem is closing or destroying the first dialog box, when handling the second dialog event or before second dialog popup on screen.
    Can anyone suggest the best approach to handle dialog destroy functionality.
    regards,
    Venkat

    hi!
    also refer to this link if you are going for dialog windows
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/903fed0d-7be4-2a10-cd96-9136707374e1
    thanks
    vishal

  • Confirmation Dialog Box

    Hi All,
    With ADF UIX, what is the recommended way to implement a confirmation dialog box to get user's confirmation before an action is actually executed? Any UIX element like <messagebox>?
    Thanks.
    Elton.

    Elton,
    The best examples we have publicly available are at http://download.oracle.com/otn/nt/ids/uix/217/uix-demo-2.1.7.zip
    (I hope the link still works)
    This is for UIX 2.1.7, which is what ships with JDev 9.0.3. You'll want to do some things a bit differently if developing with UIX 2.2 in JDeveloper 10G.
    Hope this helps,
    Ryan

  • Oracle Forms to open the Query Where dialog box

    Hi,
    "By typing a colon in a field, the end user can cause Oracle Forms to open the Query Where dialog box, allowing the end user to specify conditions that are too complex to specify by entering values into fields".
    I have tried above thing, but where clause dialog box not opening.
    Somebody can help me out.
    Regards
    satheesh kumar

    Forms [32 Bit] Version 6.0.8.27.0 (Production)
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Oracle Toolkit Version 6.0.8.25.0 (Production)
    PL/SQL Version 8.0.6.3.0 (Production)
    Oracle Procedure Builder V6.0.8.21.0 Build #1459 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 6.0.7.1.0 - Production
    Oracle Virtual Graphics System Version 6.0.5.38.0 (Production)
    Oracle Tools GUI Utilities Version 6.0.8.25.0 (Production)
    Oracle Multimedia Version 6.0.8.25.0 (Production)
    Oracle Tools Integration Version 6.0.8.18.0 (Production)
    Oracle Tools Common Area Version 6.0.8.18.0
    Oracle CORE Version 4.0.6.0.0 - Production

  • Tooltip for buttons on Confirmation Dialog Box

    Hi,
    How can we set the tooltips for buttons on the Confirmation Dialog Box.
    Pls throw some light on it.
    Rgds
    Shashank

    Found the solution:
    I Used 'ADMRadioGroupSuite1' Suite - RadioGroupSuite ("ADM Radio Group Suite") to group them. 

  • Submiting forms returns a "Save As File" dialog box

    I've got a form that users return via email, one user always gets a Save As File dialog box and since this doesn't match the instructions.  User doesn't return the form as others do.  Any help greatly appreiciated.

    JFileChooser does support a "save-as" dialog. Follow the link from the API documentation to the tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html

  • I receive a confirm dialog box, when clicking on "stay on page" nothing happens

    I receive a notice that says "stay on page or leave page". When I click on either button nothing happens, then the page locks up and I have to shut down by pressing the power button as nothing will work and restart my computer a Mac Pro new 2012.
    I get the dialog box on this site:
    <br> http://www.toolkitcma.com

    Where are these buttons? I took a look at www.toolkitcma.com, but I did not see buttons with those messages on them. Maybe it might have helped if I had an account there, and I did not want to set up one just to test. Does that problem occur with any other site?

  • How to add a title to a JavaScript Confirm dialog box.

    function confirmDelete() {
    var msg = "Do you want to continue removing the items ?";
    return confirm(msg);
    Presently it says http://locahost:8080/says etc on the title bar for the dialog box. Instead I want to set the title as "Confirm Delete". How can I do this?

    You're talking about the document title as you set it in the HTML head? Just alter the title of the document accordingly in the same Javascript function.
    If you find Javascript hard, there's a nice tutorial at w3schools.com. And for Javascript related questions better use a forum devoted to Javascript. There are ones at webdeveloper.com and dynamicdrive.com.

  • HT1343 Is there a shortcut for "Revert Changes" in the Close/Save confirmation dialog box?

    In OS X 10.8 Mountain Lion, the Close/Save confirmation dialog asks the user:
    Do you want to save the changes made to the document “Screen Shot 2012-10-12 at 12.35.12.png”?
    Revert Changes          Cancel     Save
    Is there a keyboard shortcut for this command, as there is one for Delete (Cmd+Delete) in new document closing confirmations?

    I'm not sure if there is a shortcut (I didn't find one), but if you turn on Full Keyboard Access in the Keyboard system prefs, all controls can be accessed from the keyboard. You can tab through (or arrow keys) the buttons. The active button will be outlined and can be activated with space bar. Since Revert Changes is the first button, it will come up outlined and you can just hit the spacebar to choose it.

  • Reg: Confirmation dialog box

    Hi All,
    I am using the below code for creating a dialog box. But it is giving me null pointer exception.
    IWDEventHandlerInfo ev1=wdControllerAPI.getViewInfo().getViewController().findInEventHandlers("YES");
                                  IWDConfirmationDialog dlg=wdComponentAPI.getWindowManager().createConfirmationWindow("No Customer Exists. Do you like to create new Customer?",ev1,"YES");
                                                                dlg.show();
    Kindly suggest.

    Hi
    use this
    //@@begin confirmationDialog()
              IWDConfirmationDialog confermationDialog = wdComponentAPI.getWindowManager().createConfirmationWindow(
                        displayMag, okHandle, label);
              confermationDialog.addChoice(cancelHandle, "No");
              confermationDialog.setTitle("Confirmation");
              confermationDialog.setIcon("~sapicons/s_n_crit.gif");
              confermationDialog.setWindowSize(550, 100);
              confermationDialog.show();
        //@@end
    Note : Handle represent the action not event which is there in your view pass it using
    wdThis.wdGetClickAction();
    Best Regards
    Satish Kumar

Maybe you are looking for