How to handle event when the user closing the browser (Urgent Please)

Hi,
How to handle the event when user closes the browser....
i want to display some alter message when user trying to close the browser...
Please can any one help me how i have to do this...........
Thanks.

Finally got this working. You cannot use the stop() or destroy methods. By the time they are called all database connections are gone and you will get a null pointer exception.
You will have to use the onBeforeUnload method in the html file that calls the applet and use JavaScript to call the save method in java which saves the document:
<SCRIPT LANGUAGE="JScript" TYPE="text/javascript">
function Save()
//i call the applets doSave() method from here in which i save all
//changes to the database
top.Tree.document.TestApplet.doSave();
//this will invoke the default IE message for closing the window
//when user clicks on the x in the browser
message = "Your document has been saved."
return message;
window.onbeforeunload=Save;
</SCRIPT>
//the applets doSave()
public void doSave()
//this frame provides user with the message that document is being
//saved
final JFrame frame = new JFrame("Saving");
JPanel contentPane = new JPanel();
JLabel label = new JLabel(" Please wait, saving document...");
frame.getContentPane().add(label,BorderLayout.CENTER);
frame.setSize(250, 100);
frame.setLocation(300, 400);
frame.setResizable(false);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter()
//the frame is just for user's information, so prevent user from
//closing it or iconifying it.
public void windowClosing(WindowEvent e)
frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
public void windowIconified(WindowEvent e)
frame.setState(frame.NORMAL);
//call my saveDocument() method that saves everything to the database.
editorModule.saveDocument();
//System.out.println("finished calling saving document");
//once the saving is done the frame with the message disappears
frame.setVisible(false);
//System.out.println("setting frame to false");
//I also had an exit button in my applet, that would perform the same task, however now with the above onBeforeUnload method, the exit message would appear twice, so had to modify my exit button action performed, so that if the exitbutton was clicked the onbeforeunload method would get passed a null value and not do anything.
private void exitButton_actionPerformed()
if (DEBUG) System.out.println("Calling exit");
doSave();
window.eval("this.onbeforeunload=null;");
window.eval("top.close();");
//continue from here if user cancels the closing of the window
window.eval("this.onbeforeunload=doSave;");
window.eval("top.focus()");
window.eval("document.TestApplet.requestFocus()");
homePanel.requestFocus();
}

Similar Messages

  • How to handle events when artboard list change in Illustrator?

    It is very strange for me, but AIEvent has no event type for handle artboard list change events.
    http://cssdk.host.adobe.com/sdk/1.5/docs/WebHelp/references/cshalib/com/adobe/cshostadapte r/AIEvent.html
    May be there are any ideas how to get artboard events: "add", "delete", "reorder" 

    Well, the right event type is AIEvent.DOCUMENT_CROP_AREA_MODIFIED. It is very usefull to play with EventWatcher example from Remote Creative Suite SDK Examples.

  • How to trigger event when changing user status?

    hi,
    I'm having problems in triggering my workflow.
    In CIC0, When a status of a service request is changed to 'solution provided' then after saving service request, it should send a notification mail. I'm using ZBUS200116 which is deligated to BUS2000116. I've created event 'change' in ZBUS200116 which is in the start events of my workflow.
    I've tried creating an action profile which uses my workflow. The action profile is attached to the transaction but still it doesn't trigger my workflow.
    i've checked other existing workflows which uses the same object type BUS2000116 or ZBUS200116. These workflows were triggered by 'created' and 'completed' events only. Other added events in ZBUS200116 like 'changed' is not triggered. How is this possible when ZBUS200116 is deligated to BUS2000116?
    Your response would be highly appreciated.
    Thanks in advance.

    hi juan
    so here we are,now i got complete understanding of what u r doing and why
    you know you need not have created that change event because it wont serve your purpose anyway
    the reason is that because the way process in your workflow is flowing ,it wont happen that way using change event
    you just follow these  steps:
    1, use created event in your workflow
    2. that way when your contract ios created in rpocess status the event will be triggered only because you are creating a transaction whatever may be the status,so in all such cases you should use event created.
    3. now coming to the point of change in status or documents in contract
    in this case using loop will put you in deadlock and you will only be haing the error in such case
    you use WAIT step instead ,inside it use wait using conditions out of every option
    there you give your condition as change in whatever status
    like if you are chaning the status from in process to some other status ,put that status inside the condition
    as soon as that conditioon is met ,the WAIT step will be executed,
    that way you will be able to trigger the change in status through thje workflow
    so thats the solution with the approach you are using
    there are many approaches you can follow in workflows ,so depending upon that you can follow the different worlkflow tools u have there.
    also remember when your wait step gets executed there is always the time lag of 20-25 minutes after which changes will be reflected
    hope it will solve ur probs
    best regards
    ashish

  • How to handle Event when more that 2 rows are selected in a WD Table

    Hello WD developers,
    I need your assistance.
    My case is as following:
    I have a WD table populated with data.
    I also have several buttons in the toolbar table.
    One of those buttons should be enabled only in case that one row (and only one)
    is selected in the table otherwise it should be disable.
    The problem is that an even is triggered only when the first row is selected
    and when the second (third....) are selected no event occur.
    Do you have any idea How can I solve this issue.
    Thnaks in advance for your help.
    Regards
    Harry

    Hi,
    In the Onlead selection of table make it visible and invisble of your buttons as per your selection.
    The table have single selection and multi seletion options are availble when you defing the table you can find this options in the properties of the table.
    In onlead selection your button to be mapped with attribute WDVisble.
    And based on your selection you can visible and invisible.
    wdContext.currentContextElement.set<attribute>(WDVisble.Visble);
    and
    wdContext.currentContextElement.set<attribute>(WDVisble.NONE);
    This might helps you.
    Do you need more post your issues.
    Thanks,
    Lohi

  • The user closed the browser while still connected

    hello
    Like when using regular internet site, the user can at any moment close the browser withoug logging out. In this case, the JDBC connection will remain open (i guess until the session timesout), is there a way to handle these open session and close them to release the session from the database
    regards

    dear sir..
    when you deploy the Application into an oracle application server, specify the DataSource for it, There you will find in addition to connection details some timer settings specifying how many seconds the server waits on idle connections before closing them.
    regards

  • How to handle Event when a radio button in selection screen is clicked

    Hi all,
       What is the Event generated when a radio button is clicked in the selection Screen. My requirement is .If one radio button is clicked a field in selection screen should be greyed.
       Here I used AT SELECTION-SCREEN OUTPUT. but this event is generated only if i press 'ENTER' after clicking the radio button in the selection screen.
       Is there any other way to process this radio button event?
    Thanks&Best Regards,
    Vishnu

    hi,
    try like this
    TABLES : kna1,lfa1.
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : rad_but1 RADIOBUTTON GROUP one DEFAULT 'X' USER-COMMAND ucom.
    SELECTION-SCREEN COMMENT 3(26) text-003.
    SELECT-OPTIONS : kunnr FOR kna1-kunnr.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : rad_but2 RADIOBUTTON GROUP one .
    SELECTION-SCREEN COMMENT 3(26) text-004.
    SELECT-OPTIONS : lifnr FOR lfa1-lifnr.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN:END OF BLOCK blk1.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF rad_but1 = 'X'.
          IF screen-name = 'KUNNR-LOW' OR screen-name = 'KUNNR-HIGH' .
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-name = 'LIFNR-LOW' OR screen-name = 'LIFNR-HIGH'.
            screen-input = '0'.
            REFRESH lifnr.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
        IF rad_but2 = 'X'.
          IF screen-name = 'KUNNR-LOW' OR screen-name = 'KUNNR-HIGH'.
            REFRESH kunnr.
            screen-input = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-name = 'LIFNR-LOW' OR screen-name = 'LIFNR-HIGH'.
            screen-input = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDIF.
      ENDLOOP.
    reward if usefull....

  • How can flex tell if  it's a mouseup event when the user releases the mouse button outside the flex application?

    how can flex tell if it's a mouseup event when the user
    releases the mouse button outside the flex application? Say for
    instance mousedown was done within a 500x500 embedded flex app but
    mouseup is outside or relased on the HTML background. One more
    thing, when we have something draggable, Flex doesn't execute the
    stopDrag() when the user releases the mouse button outside the
    embedded swf or fles app. Pls. help me with this. Thanks!

    I don't think the flex app can tell what happens outside the
    app. But it can detect when it leaves the app, so I have found the
    following line works fine inside initApp():
    this.stage.addEventListener(Event.MOUSE_LEAVE, yourFunction);
    and you have to:
    import flash.display.Stage;
    Doug

  • How to handle event from subVI in the main VI?

    Hello,
    I'm doing some measurement. During the measurement I want the user to see some activity dialog - that's easy to do. Before the measurement starts I dynamically run VI (EX_Progress.vi) that shows some activity and then I do the measurement (in my example simulated by random number generation) . After the measurement is done (or error occurs) I can dynamically abort the activity indicator. But on the other hand I want to give to the user chance to abort the measurement manually via the activity dialog by STOP button. There are some ways how to do it via global variable and check every iteration in the main VI it's state but isn't there some better way? Would be nice to run event in the main VI when the user pushes the STOP button in the Progress VI. Is it possible to achieve this using register events? I tried but don't really now how I'm not familiar with this technique.
    Thanks in advance
    Message Edited by ceties on 11-26-2007 01:34 PM
    LV 2011, Win7
    Attachments:
    Ex.zip ‏374 KB

    OK, here's an example using User Events. It doesn't directly have the main VI listen for the Button press event in the subVI. Instead, it has the main VI listen for a custom User Event that the subVI fires every time there's a button press. You could theoretically directly listen to the button press directly from the Main VI, but you would have to somehow get that control's reference to the main VI. That would require storing a copy of it in a global or some such method. This method I will show here is very common and is definitely worth learning.
    For more info on User Events, refer to the LabVIEW help. You can learn more by clicking any of the User Event VIs and selecting Help from the shortcut menu.
    (I didn't set the subVIs front panel to open automatically, so you'll have to do that yourself to see anything from this demo...)
    Message Edited by Jarrod S. on 11-26-2007 02:51 PM
    Jarrod S.
    National Instruments
    Attachments:
    Example.zip ‏25 KB

  • How to make a text field required at run time when the user clicks the checkbox ?

    I got a form where , there are several checkboxes and text fields associated with that checkboxes.If the use clicks on the check box then the associated
    text fields should become required.I have tried the change event and the click event for the checkboxes.It gives error in the onChnage event and I got some weird results in the on click event .Sometimes if the user click the check box , then for the 1st time the field doesnt become required , then the user onclicks the check box and when the user clicks the checkbox for the second time the field becomes required,but if i deselects the highlighted field option and selects it again the field becomes required even if the user onchecks it I am totally confused !!! Adding to it i have also written the wrong code still i achieved the desired result ?? How it can be possible . I am writing the codes below , please help me as i am working under a deadline from the client.
    onChange event :
    var newVal = this.boundItem(xfa.event.newText);
    if(newVal == 0)
        xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.Purchasecost3_1" ).validate.nullTest = "disabled";
      else
         xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.Purchasecost3_1" ).validate.nullTest = "error";
    For the onClick event :
    var a = xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row2.CostItemRecovere d_OnlyEnergyCharges").rawValue;
    //app.alert(a);
    if(a == 0)
        xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").validate.nullTest = "error";
      if(a == 1)
          xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").validate.nullTest = "disabled";
       Please help someone !!!

    I used the onchange event and wrote the code for it. I got the result . But there is a problem.All these fields are in a table and it's a dynamic table where you can add rows dynamically at the run time .I have other change event for some fields in this table .All are working fine when i add the row.But for this check box the required fields are not validated as required at the run time . I am here giving the code , Please help me .
    form1.Subform0.Subform1.Subform9.Subform10.Table48.Row2.CostItemRecovered_OnlyEnergyCharge s::change - (JavaScript, client)
    if(this.rawValue == "1")
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L2_1").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L1_2").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L2_2").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L1_3").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L2_3").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L1_4").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L2_4").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L1_5").mandatory= "error";
      xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L2_5").mandatory= "error";
    else
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L1_1").mandator = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row4.ComplianceCheck_ L2_1").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L1_2").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row5.ComplianceCheck_ L2_2").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L1_3").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row6.ComplianceCheck_ L2_3").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L1_4").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row7.ComplianceCheck_ L2_4").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L1_5").mandatory = "disabled";
    xfa.resolveNode("form1.Subform0.Subform1.Subform9.Subform10.Table48.Row8.ComplianceCheck_ L2_5").mandatory = "disabled";

  • How to remove save, cancel option when end user runs the workbook in Portal

    Hi,
    how to remove save, cancel option when end user runs the workbook and make some small changes like using page items or increasing rows and columns
    I already made 2 changes
    1) I removed the option in Oracle Enterprise Manager under discoverer viewer of saving
    2) I also removed the option of Allow saving changes made in Viewer when adding workbook to portal
    But still the end user gets options of saving when made small changes to workbook like increasing rows and columns
    Is their any place, I need to make changes?
    Thanks in Advance
    Rowdheer

    Don't use JSP to serve a binary file. It almost implies the use of awful scriptlets and the invocation of both the response writer and the response outputstream which would only lead to IllegalStateException headaches in the server logs.
    Use a Servlet instead. Specify the file name as request parameter and let the servlet read the file and write it to the outputstream of the response.

  • How do you have the help file .chm hold its window position when the user resizes the help window.

    One of my customers is complaining that the help contents will scroll out of view when the window is resized.  Is there a way to anchor the position while the window is resized?

    My CHM is a help file for an application. The application uses F1 to open specific topics for help.  Therefore the help file needs to be visible but not cover the application to much. The Content in this situation is text however the help project contains Images, tables, text, etc. 
    If the user searches for the word "audio" in the search and it takes them to a section or sub topic that is half way down in the Topic, they would like that section or subtopic to stay in the same place as they resize the help window.  Using Bookmarks if the topic is large enough clicking the search link will place the results in the top left of the doc view window, however this is not necessarily the top of the topic. 
    Im not sure how else to explain what the user is seeing, sorry.
    Please explain "Also whether it remains consistent depends on whether an absolute or percentage value has been added to it."

  • How to clear sessions in java while closing the window

    Dear all,
    When I am closing the window if I click 'x' on window how to handle that event in java script , or any other way for this event handling.
    Sudheendra.

    Thank you very much ,
    In my application for each login i am using different sessions.
    In one login if a user navigating then there is no chance of opening different windows.
    So when the user without clicking logout button , if he closes the window by clicking 'x' , then the session allocated for this login is retaining until the session time out.
    so i want to invalidate the session for this particular login .
    Thank you,
    Sudheendra.

  • When the user Clicks the Modify button remaining Buttons should be dispayed

    Hi experts,
                         In my application  I have 3 fields and three buttons(Modify ,save and cancel)...The 3rd field is DATE field ...i have to display only MODIFY..and the remaining 2 buttons should be disable mode at Runtime.
    1) when the user clicks the MODIFY button....then only other two buttons should be visible in my current application.
    2) when the user clicks the SAVE button....the 3rd field should displayed with current date or System date.
    3)whenever the user modify the details using modify button...meanwhile if the user clicks the cancel button...all three fields goes to Read only mode...
    Thanks In advance for all.
    how can i write the logic for all these 3 requirements...can anybody plz help me...
    Regards,
    Praveena..
    Edited by: s.praveena on Jun 14, 2010 7:36 PM
    Edited by: s.praveena on Jun 14, 2010 7:39 PM
    Edited by: s.praveena on Jun 14, 2010 8:01 PM

    Basically you want to handl the visibility and read-only properties of the UI elements at runtime.
    To handle visibility property create a context attribute of type WDUI_VISIBILITY and bind it with the UI element's visible property.
    in MODIFY action handler set this context attribute to IF_WDL_CORE=>VISIBILITY_VISIBLE to make it visible
                                                                                    IF_WDL_CORE=>VISIBILITY_NONE to make it invisible.
    Similarly to handle the read-only behaviour, create the context attribute of type WDY_BOOLEAN and bind it with the readonly property of the UI element.
    and in action handler assign a value to the context attribute. ABAP_TRUE to make it readonly
                                                                                    ABAP_FALSE to make it editable.

  • How to Handle events from audioplayer by ADF ObjectMedia Component

    Hi,
    In My application Having a ADF ObjectMedia Component for the audio play,
    My requirement is to handle the events from the Player,i.e Need to get an
    event when the user pause the player,can i get the event in backing bean.or else please help me in any other way to get the requirement asap.
    Thanking you....

    Hi,
    assume the media player most likely is a browser plugin. Question: Does the media plugin raise events ?
    If the media player has a JavaScript API that allows you to call a JavaScript function then you found a gate open to publish the event to the JSF application
    So as a todo for you: Check with the media player vendor if there exist a JavAScript API or any other sort of eventing.
    Frank

  • How to find out the user from the Jobs queue in Report server

    Hello All!
    I have a doubt about finding out the user from the scheduled jobs queue. Say I go ahead and schedule a report on Reports Server how can I find out the user name. When I view the jobs using showjobs I could see that the DBMS_JOBS table has a column under "Job Owner". But it invariantly shows it is "rwuser". So is there a way to find out which user has scheduled which job?
    Regards
    Shobha

    hi,
    The below tables will give only the name .
    USER_ADDRS
    USER_ADDR
    USER_ADDRP
    USR02
    i think you need email address .
    you can use this Tcode : su01d
    and give the user name and excute it
    i hope it will help you.
    Ram
    Edited by: Ram velanati on Jun 30, 2008 6:57 PM

Maybe you are looking for

  • F110 Inter company clearing

    Hi Guys, AFter paying from once co. code to a vendor in the other co code what are the next steps to be taken for clearing? Do we need to do anything after doing inter company payments through F110. Thanks srikanth.

  • PR LINE ITEM DELETION

    Dear Experts, I m tryinng to delete the line item for PR but system is giving the message that This PR cannot be changed Messge No SU000. PR has the status as PO created, PO line item alerady deleted. Please guide

  • External disks suddenly frequently 'unreadable'

    I have 2 external disks that in the past few days have been connecting unreliably to my MBP. Sometimes I can plug them both in (via a FW hub) and both will mount immediately - as they have always done. But it's becoming just as likely that a red dial

  • Graphic tool to generate java code

    Does it exist any graphic tool that generates java code from the shapes? something like the form editor of Netbeans for example, or a plugin for other graphic editors like adobe photoshop... tnx a lot I tried to search through the the whole web or ja

  • Wanted: Recommendations for Oracle/Java Web Hosting

    I'd like to make some Java/JSTL servlets that access an oracle database. Can someone recommend a hosting service? I'm most familiar with the open source products like JBoss and Jetty and tomcat. Thanks Siegfried