Save to Database before exitting the page

Posted on 2004-04-01
Medium Priority
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?

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

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 375 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. 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 : Open Page or Post…
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
Suggested Courses

752 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