Save to Database before exitting the page

Posted on 2004-04-01
Last Modified: 2010-04-07
Dear All,

I have this entry form that contains some links (static and dynamic), also some buttons that can take the user to other pages.

Now, I need to save the data, before exitting the page, no matter where the user is to go,

I though of resubmitting on the same page passing the NextUrl, and then after saving, to redirect to the new page.

But, this is to complex, since there are some links that does a lot before going to other pages.

so, I am thinking of a listener page, that i can submit to which will save all the data, and then the form will go to whereever it was going,

do you think that this is doable, and if you have any other suggestions, please let me know.

Question by:Inteqam
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
LVL 35

Expert Comment

ID: 10733090
Well, first of all what language are you using?

Either one of your ideas will work.

In fact they are actually the same idea - it is just whether you use the same page as the "listener page" or a spearate page - and that is up to you.

The thing you would have to keep track of is the destination that the button/link/control/etc would be taking you to and the action that would be done in each case.

Then you can set up a switch/case statement - or even a series of if/elseif statements on the listener page.

Expert Comment

ID: 10741899
Think of using Sybase Powerbuilder with EAServer, Power J or JBuilder.

Create NVOs (Non-visual objects) on Powerbuilder
Create Datawindow forms using Powerbuilder
Deploy them to EAServer
Create Stubs and Skeletons

Using PowerJ or JBuilder create JSP's Servlets and EJB's (if req'd)
Deploy to EAServer

Open in a thin client solution, Browser only, and POOF!!! The database can be anything, Oracle, MDB, ASE 12.5, INFORMIX, Etc....

I have a solution that my colleague and I developed.  We have 5 small base objects.

Its fairly complex but it works and has been developed for applications for the Department of Defense, The US Navy SPAWAR program and Texas Workforce Commission.


Author Comment

ID: 10751318

and, sometimes, those button should do a submit to a new page, that is a form full o Hidden fields,
i can submit it to a lister page, refill all the hidden fields and resubmit to a new page,

is there a way to resubmit the request to another form?

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

LVL 35

Expert Comment

ID: 10758015
Yes what you do is that you have to first write all of the fields that were submitted to the first page as hidden variables and then submit to the new page

Or you can save the values as session variables instead of writing to hidden fields.

Author Comment

ID: 10758690
well, writting all the fields again is my idea that i don't want to implement
and using session fields is not an option,

anyhow, i redesigned the bage, and restricted the save to only 3 links, other than that the form doesn't save.

sad to say so, but i was in a hurry.

thanks all.

Expert Comment

ID: 10829564
If you are still looking for solution

There is a way to handle this using the body event called onbeforeunload(but strictly to IE users only).

In that event you can make a request to one ASP Page to insert the date with the help of XML DOM Object. You can pass the data as XML Node tree to one ASP Page and insert everything. After finishing that process you can return true or false according to the successful insert or update operation then allow the users to goto any other page or display the error message


Expert Comment

ID: 10903136
if u are thinking for a listener page then u can just pass the values as aruguments and one more argment which contains the destination (that which link was clicked)

i am sorry coz i am giving a JSP eg
In jsp a page with arguments can be called like:

in this way those args will be available on next page and there u can write the database code, after this desired page will be displayed.


Author Comment

ID: 10911274
I solved this by useing a  middle page with no GUI, a page that saves then redirects, I did that for only some of the exits of the page, the client was satisfied, anyhow, i would like to know if there is a listener page, so that i can submit to the server without refreshing the page, just to do things on server.

is that doable?

Accepted Solution

kssaran earned 125 total points
ID: 10914584
Hi Inteqam,

As I said the only to pass data to server without refreshing page is to use XML DOM. I am sure that u will get the solution required by you through this method. If you want any sample on this you can search thru google using keyword as XML DOM Object. You will get plenty of sample

Happy Coding


Author Comment

ID: 10916047
Thanks Sara,

that helped

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This article provides a case study on how our local youth baseball league deployed a new website, including the platform selection, implementation and benefits to the league.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…

705 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