Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Save data on exit


Message #1 by bart@d... on Wed, 6 Nov 2002 11:27:01
Hello,

We need to write a program on the web (with ASP) for a company.  The 
people must login at the website and then fill in some forms.  Now they 
ask us if it's possible to save the data automatically.  For example, if 
they fill in the form and close the window or "click" on "back" in their 
browser without saving the information, that they receive a message who 
says that they haven't yet saved the data.

Is is also possible to do this directly?  For example, they close their 
browser and then they get a message "You haven't saved your data.  Please 
save it now" and a "OK"-button.  Is it possible that when they click on 
the button "ok" that the data is automatically saved? Or not ?

Has anyone any suggestion ?

Best regards
Bart
bart@d...
Message #2 by SARGHI Mircea Ionut <syms@i...> on Wed, 6 Nov 2002 13:30:10 +0200 (EET)
I have not tried but it is a sugestion:

Put a function on unload that saves the form(client side).
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function window_onunload() {
	//here do the form submit...
}

//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=javascript onunload="return window_onunload()">

Now this should work if only if they do not close the window...but for 
changing the page without saving it should.
Hope it helps.

On Wed, 6 Nov 2002 bart@d... wrote:

> Hello,
> 
> We need to write a program on the web (with ASP) for a company.  The 
> people must login at the website and then fill in some forms.  Now they 
> ask us if it's possible to save the data automatically.  For example, if 
> they fill in the form and close the window or "click" on "back" in their 
> browser without saving the information, that they receive a message who 
> says that they haven't yet saved the data.
> 
> Is is also possible to do this directly?  For example, they close their 
> browser and then they get a message "You haven't saved your data.  Please 
> save it now" and a "OK"-button.  Is it possible that when they click on 
> the button "ok" that the data is automatically saved? Or not ?
> 
> Has anyone any suggestion ?
> 
> Best regards
> Bart
> bart@d...
> 
> ---
> 
> Improve your web design skills with these new books from Glasshaus.
> 
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
> 

Message #3 by "Drew, Ron" <RDrew@B...> on Wed, 6 Nov 2002 08:36:24 -0500
I use Javascript...something like this....cut and paste and change to
your liking...
<script language=3D"JavaScript">
<!--
function okay()
{
 var okay =3D true;
 var message =3D "";
 if (!confirm("Save your data?"))
 {
  return false;
 }
 if (document.forms[0].txtField.value =3D=3D "")
 {
     okay =3D false;
     message =3D message + "Please enter a value in the text box.\n";  }
if (!okay)  {
    alert(message)
 }
 return okay;
}
file://-->
</script>

-----Original Message-----
From: SARGHI Mircea Ionut [mailto:syms@i...]
Sent: Wednesday, November 06, 2002 6:30 AM
To: ASP Web HowTo
Subject: [asp_web_howto] Re: Save data on exit



I have not tried but it is a sugestion:

Put a function on unload that saves the form(client side). <SCRIPT
ID=3DclientEventHandlersJS LANGUAGE=3Djavascript>
<!--

function window_onunload() {
	//here do the form submit...
}

//-->
</SCRIPT>
</HEAD>
<BODY LANGUAGE=3Djavascript onunload=3D"return window_onunload()">

Now this should work if only if they do not close the window...but for
changing the page without saving it should.
Hope it helps.

On Wed, 6 Nov 2002 bart@d... wrote:

> Hello,
>
> We need to write a program on the web (with ASP) for a company.  The
> people must login at the website and then fill in some forms.  Now
they
> ask us if it's possible to save the data automatically.  For example,
if
> they fill in the form and close the window or "click" on "back" in
their
> browser without saving the information, that they receive a message
who
> says that they haven't yet saved the data.
>
> Is is also possible to do this directly?  For example, they close
> their
> browser and then they get a message "You haven't saved your data.
Please
> save it now" and a "OK"-button.  Is it possible that when they click
on
> the button "ok" that the data is automatically saved? Or not ?
>
> Has anyone any suggestion ?
>
> Best regards
> Bart
> bart@d...
>
> ---
>
> Improve your web design skills with these new books from Glasshaus.
>
> Usable Web Menus
> 
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogram
> me
> r-20
> Constructing Accessible Web Sites
>
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
> r-20
> Practical JavaScript for the Usable Web
>
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
> r-20
>



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20

  Return to Index