How to Warn The Users If They Try To Close The Browser When A Forms Session Is Running

There is some code (javascript) that can be used to add a warning for the users if they try to close the browser when a forms session is running and they can lose the unsaved changes.

For this you have to do some simple steps:

  1. Go to $ORACLE_HOME/forms/server
  2. Edit your HTM file used (basejini.htm) or create a customer one.
  3. Add a javascript code like explained bellow after the BODY tag.
    Replace this code:

    <BODY %HTMLbodyAttrs%>
    %HTMLbeforeForm%

    With:

    a. This code:

    <BODY %HTMLbodyAttrs%> 
    <script language="JavaScript"> 
    window.onbeforeunload=confirm; 
    function confirm() { 
    event.returnValue = "Closing Oracle Forms Application. Any unsaved changes will be lost! OK to Continue with close ?"; 
    } 
    </script> 
    %HTMLbeforeForm%
    Note:  This code is working only on Internet Explorer browser.

    OR

    b. This code:

    <BODY %HTMLbodyAttrs%>  
    <script language ="JavaScript1.2" type="text/javascript"> 
    window.onbeforeunload=unloadMess; 
    isSolved = false; 
    function unloadMess(){ 
        mess = "Closing Oracle Forms Application. Any unsaved changes will be lost! OK to Continue with close ?"
        if(!isSolved) return mess; 
    } 
    </script> 
    %HTMLbeforeForm%

    Note: This code is working with Internet Explorer, Netscape and Mozilla Firefox browsers.

  4. After that save the file and start a new session.

Ref:[ID 472228.1]

Advertisements

About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email: sher487@hotmail.com
This entry was posted in Oracle Application server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s