473,796 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unload for close not refresh

I have a jsp page that updates information as a user enters form
fields. It's part of an AP system where a user can select a category,
and then it refreshes the page, pulling relative info into other form
fields.

The issue we have is that closing the window with the [x] closer does
not clear out buffered info. We have a "close" button that will do
this. I tried doing an "onunload" to call the same function as the
close button, but since the form is reloaded as the user tabs through
fields, it calls the onunload and the window closes.

Does anyone have an idea of how to call the close function when the
window closes, but not when it reloads?

Thanks for any help.

D.
Jul 20 '05 #1
2 3442
On 2 Mar 2004 14:45:23 -0800, DonO <do*@orbandesig n.com> wrote:
I have a jsp page that updates information as a user enters form
fields. It's part of an AP system where a user can select a category,
and then it refreshes the page, pulling relative info into other form
fields.

The issue we have is that closing the window with the [x] closer does
not clear out buffered info. We have a "close" button that will do
this. I tried doing an "onunload" to call the same function as the
close button, but since the form is reloaded as the user tabs through
fields, it calls the onunload and the window closes.

Does anyone have an idea of how to call the close function when the
window closes, but not when it reloads?


That cannot be done reliably. onunload is called at different times by
different browsers and some, like Opera, do not fire onunload when the
browser is closed.

Even if it were, it is highly unlikely that anything you do will actually
have an affect as a browser probably won't open a connection to a server
when the user is trying to close it.

Instead, impress upon your users the importance of sending their data
before closing their browser.

Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #2
Michael Winter <M.******@bluey onder.co.invali d> wrote in message news:<op******* *******@news-text.blueyonder .co.uk>...
That cannot be done reliably. onunload is called at different times by
different browsers and some, like Opera, do not fire onunload when the
browser is closed.

Even if it were, it is highly unlikely that anything you do will actually
have an affect as a browser probably won't open a connection to a server
when the user is trying to close it.

Instead, impress upon your users the importance of sending their data
before closing their browser.

Mike


Thanks for the reply Mike. Fortunately (I suppose) this is for an
internal project, so I know all my users will be using IE 5.5 or
higher.

I did find something that works, but is really ugly...

I added a new form at the bottom of the page named close_check with a
hidden field with the name "close_me" and default value "1" (true).

I put in a call to a function called "tabCheck() " in all the places
where the tabbing forces the page to reload. This function would set
the "close_me" value to "0" (false) like this:
document.form_c heck.close_me.v alue = 1;

My onunload then called a function to which checked the value of
"close_me" if it was "1" it did the close, otherwise, it set the value
back to "1".

So the order of how things happen is:

1) User tabs over fields that reload page
2) "close_me" is set to false
3) onunload function is kicked off
4) Because the close_me value is false, it does NOT close the window

Other scenario:

1) User clicks the [x] to close the window
2) onunload function is kicked off
3) Because the value is set to 1 by default, or at the end of checking
it above, it is true, and the close function is called, just as if
they clicked the "Close" button we have on the page.

So far it seems to work. If anyone has any better ideas, I'm open to
suggestion. For now, with IE this option is ok.

Thanks again,
D.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
20857
by: Harry J. Smith | last post by:
I have written a Visual Basic program that does a long calculation and writes the results to disk as it runs. If I click the Close button the window closes but the program keeps running. How can I get the program to recognize that its window has been closed and quit running? -Harry http://home.netcom.com/~hjsmith
1
4215
by: salo | last post by:
hi at visual basic 6 i write this to the button1_cl1ck unload form1 form2.show
4
1950
by: V.Boomessh | last post by:
Hai can any one help me on this problem. I am new to VB.NET. I have 2 forms. (form1 and form2) On click of a button in form1 i want to show form2 and unload form1
4
21542
by: Claudia Fong | last post by:
Hi, I have more than one forms in my program, and I would like to for example, in form1, I will call form2 and in form2 it will call form3. But the problem is when I call form2.Show, it does show the form2, but how can I unload form1? If I put form1.close, it will close everything. :(
3
3214
by: Gauthier Segay | last post by:
Hello, I've an application where all my pages implement a PAGE_CODE string property, this property is stored in HttpContext.Current.Items. In some page, I must persist data in session while the user perform operation on this page (postback navigation based). I also need to clean up the session data when the user leave the page (by a anyway). My question is about the Unload event, is it safe to use the unload
8
17939
by: Sender | last post by:
In VB6.0 we use Unload Form1 to unload (close) form1 - what shall we have to write to unload a form in VB.Net
2
22630
by: sam | last post by:
I want to know how to unload form / application in VB.Net. In VB 6, the coding is Unload Me but how about VB.Net? VB.Net 1.1 Coding -------------------- Private Sub InitializeComponent() Me.SuspendLayout 'MainForm
1
8568
by: Donkey Cart Racer | last post by:
Hi, I have a page - page1 which opens a window1 where users can look at tasks, in window1 users can click and open window2 where they can create new tasks I want to refresh window1 when window2 closes and refresh page1 when window 1 closes
5
5903
by: =?Utf-8?B?U3RldmVuIFRhbmc=?= | last post by:
It seems that one page XBAP whose Unloaded event never get called, I need put some clearing stuff (I.G stop dispatcher time) when user close browser, it unload event doesn't work, where shall I put? -- ======================= Steven Tang SYWWUYU)
0
9524
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.