Solved

Trouble submitting with onunload

Posted on 2004-09-29
7
207 Views
Last Modified: 2010-04-07
I am trying to automatically submit a form when the "onunload" event fires.  The problem that I'm having is that the page doesn't seem to submit when I fire the onunload event.  Any ideas as to what may be happening?  A snippet of my code is attached below.  Thanks.

<body onunload="frmPhase.submit();">
  <form method="POST" name="frmPhase" action="TestPage.asp?Update=Y">
     <input type="test" name="DatatField">
  </form>
</body>
0
Comment
Question by:TheChos
  • 4
7 Comments
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 125 total points
ID: 12184883
The user has left; ended the session;  the page is dead.  The onunload event is for doing things like putting up a thank you for visiting message.  You cannot do forms processing off of it because there is no longer a place to send the response.  The user has left.

Cd&
0
 
LVL 50

Assisted Solution

by:Ryan Chong
Ryan Chong earned 125 total points
ID: 12186622
Generally what i will do to force what user entered is captured when they didn't click on the "submit" button and exit the page (including you close it by clicking cross (x) button at title bar) is to popup another page (as Cobol already mentioned, some sort of thank you page), so that we can save the info via that popup form.

Alternatively, you can close that popup form automatically for certain time interval if you want, so that user not getting irritated by the popup page.

regards
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12190492
And what about the growing number of users with popup blockers?  Even when you do get the popup fired transferring form data is unreliable; may trigger a security alert; and may be block with user settings because it is re-directed form data.

Cd&
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:TheChos
ID: 12338172
I was able to correct the problem using input from both responses.

Administator, please split the points.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12340291
TheChos,

You have the option to do the split.  Right after the last comment there is a link to split points.  Just click it that then you can assign points to multiple comments.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 12342131
TheChos,

Would you please explain the reason for the C.  As C is the lowest grade you can give it generally means that the experts were not very helpful, but your comments indicate that you solved your problem based on our comments.  

Cd&
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question