7 Replies Latest reply on Dec 6, 2012 3:27 PM by Michael Ferrante-Oracle

    Web Forms - Users X'ing out of the browser

      Hi. We are running Web Forms 10g against an Oracle 11g database and we use Internet Explorer 8. I'm having an issue where users will post an update to a record in a form, but then unexpectedly X out of the browser without saving or abandoning their changes. This essentially leaves the record locked on the database for 15 minutes before it's mysteriously released. In the meantime other users are unable to update the record.

      Can I programatically stop users from X'ing out of the brower and force them to either save or exit without saving the record? This seems like it might be a common problem developers struggle with? Or is there something else I should be doing to prevent this?

      Also...is it possible to identify locked and orphaned records via a SQL script? Perhaps I could run a script every so often that identifies any orphaned, locked records and frees up the record lock?

      Any thoughts or solutions would be greatly appreciated.
        • 1. Re: Web Forms - Users X'ing out of the browser
          Michael Ferrante-Oracle
          The 15 minute delay you are seeing is the result of the Forms runtime being orphaned. After 15 minutes of not hearing from the client, the runtime assumes that the client is gone and all related server side processes and sessions are terminated. The length of time is determined by FORMS_TIMEOUT, which has a default value of 15. That said, it is important that you do not change this value to something less than the value of HEARTBEAT, which is 2 by default. In fact, I always recommend that the value of FORMS_TIMEOUT always be at least a total of 2 greater than HEARTBEAT. So if HEARTBEAT is 2 then FORMS_TIMEOUT should be 4 or greater.

          As for preventing the X'g out of the browser, well there are probably many ways to do it. The question is, how much effort do you want to put into handling it. The easiest way will be with java script, however many examples will only work with Internet Explorer. Browser like Firefox would need minor setting changes in order for similar code to work. If you have access to MyOracleSupport, take a look at this note for more information:
          <blockquote>How To Trap Attempts At Closing The Browser Running A Forms Application (Doc ID 605327.1)</blockquote>
          1 person found this helpful
          • 2. Re: Web Forms - Users X'ing out of the browser
            Great. Where do I find these two parameters?
            • 3. Re: Web Forms - Users X'ing out of the browser
              Michael Ferrante-Oracle
              FORMS_TIMEOUT is set in default.env and HEARTBEAT is set in formsweb.cfg . However, these may not defined by default in 10.1.2. So if you want to change the default value(s), you first would need to define the parameter. The documentation is a good starting place:

              1 person found this helpful
              • 4. Re: Web Forms - Users X'ing out of the browser
                So the doc you recommended is awesome. Thank you. It has me using this java script code:
                <BODY %HTMLbodyAttrs%>
                <script language ="JavaScript1.2" type="text/javascript">
                isSolved = false;
                function unloadMess(){
                    mess = "You have attempted to close the browser using the X control. This will cause the application to lock records. Click CANCEL now and then use the applications Exit functionality or contac
                t ITS for support."
                    if(!isSolved) return mess;
                It displays a pop-up with the message and two buttons. OK to continue closing the broswer, and Cancel to keep the browser open.

                Would you or anyone happen to know if there is an alternate function that would show only the Cancel button? Or is there a way to force both buttons to leave the browser open? It's so close to what I need, but it still gives the uncooperative user an option to mess up if they choose OK.
                • 5. Re: Web Forms - Users X'ing out of the browser
                  Ady Keeling
                  You won't get any better than this. The browser will always offer the user an option to close. Think about an unwanted pop-up advert from some dodgy internet site, you're not interested and want to get rid of it, if the browser allowed the web developer to not allow users to exit, you'd get a lot of angry surfers changing to a browser that did let you exit.
                  1 person found this helpful
                  • 6. Re: Web Forms - Users X'ing out of the browser
                    Hi. I'm finding that the message pops up even when the user attempts to exit my form using the exit_form built-in? I was hoping the pop-up would only occur when the user attempts to close the browser by clicking the X. Is this the expected functionality or an I doing something wrong by using the exit_form built-in?
                    • 7. Re: Web Forms - Users X'ing out of the browser
                      Michael Ferrante-Oracle
                      The java script in the web page and the actual form (java applet) don't communicate with each other. Therefore, the browser has no idea that the form was exited or if it is still running. The js suggestion is useful in most cases, but does not take into account every situation. Likely js can be enhanced or replaced by something else. If IE is the main browser being used, then VBScripting may offer some better options. A Google search can help you with that.

                      If you plan to use the js option, I'd recommend wording your dialog to say something like the following:
                      <blockquote>" +Be sure that you have properly saved your work and exited the application before closing the browser. If you have not properly exited the application, click Cancel now. Closing the browser without exiting the application first can leave some changes unrecorded or prevent other users from gaining access to them.+ "</blockquote>
                      Now, with all that in mind, the problem you are describing has been an issue for quite some time. However, with each new release of Forms and the JRE the handling of this issue has improved. For example, if you are using Forms and an older JRE you likely will find that if a user exit the browser while a form is still running the server side process will remain running at least until FORMS_TIMEOUT is reached. In with a newer JRE (e.g. 1.6.0_10+), the server side process will almost immediately terminate when the browser is close assuming no uncommitted changes have been made to the db. In v11, even with uncommitted data, the server side process will close almost immediately. Obviously there may be some conditions that can cause an orphaned server side proc, but generally the complete session will be terminated if the client is shutdown. Uncommitted changes will rollback.

                      Consider moving to Forms 11.1.2 ;)