Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit on leaving page...

Status
Not open for further replies.
May 9, 2000
446
GB
Can anyone tell me whether its possible to submit a form / save its data to a dbase by just leaving the page? Ideally my page would submit when they click on the link to the next record so long as something in the form had been edited / entered???
 
You're going to need to write some client-side script. Declare a page level Boolean variable that equates to true if any of the controls on your page are populated or changed. In your next-page link, instead of just going to the next page, call a subroutine that either submits the form (with the forms action being the next page) or just navigates to the next page based on the status of the Boolean variable.
 
add this to your body tag:

<body onunload=&quot;dosomething();&quot; ...>

then write your javascript to submit the information on this page to store it.. (you probably would want to open the page up as a popup and then automatically close it so it becomes as transparent to the end user as possible)

Hope this helped.

Cheers,

G.


GT Interactive
-----------------------------
Components/Tools/Forums/Software/Web Services
 
The javascript to submit is:
window.document.FormName.submit();
 
cheers for the responses I'll go give it a go, took me a while to get back onto this!

Ta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top