MitchellVII
asked on
Want to automatically save webform contenst anytime the user leaves the form...
Hi, I have a webform that consists of multiple pages. I am running some .asp script to save the data to a MySQL Database when the user clicks a button on the bottom of the form.
However, I would like to trigger the form action so that the changes made are saved anytime the user navigates away from the page just in case they accidentally go to another page without clicking the button and lose all their data.
How do I do that?
However, I would like to trigger the form action so that the changes made are saved anytime the user navigates away from the page just in case they accidentally go to another page without clicking the button and lose all their data.
How do I do that?
ASKER
Thanks.
Ok, my current <form> looks like this:
<form method="post" id="DocEPW_IT_Demographic" action="scripts/asp/DocEPW _INSERT_IT _Demograph ic.asp" enctype="multipart/form-da ta">
and my button looks like this:
<input name="Submit" type="submit" class="button" value="Save and Continue!" tabindex=-1>
What exactly would I add to my body tag to make it run my .asp script on the "onbeforeunload" event?
Ok, my current <form> looks like this:
<form method="post" id="DocEPW_IT_Demographic"
and my button looks like this:
<input name="Submit" type="submit" class="button" value="Save and Continue!" tabindex=-1>
What exactly would I add to my body tag to make it run my .asp script on the "onbeforeunload" event?
That dialog box would drive me nuts, I could imagine what your visitors would do/think
If they had to put up with that box and its annoying noise, especially if you have a person
On your Form, that has his music turned up loud, that Dialog noise can take out your speakers.
You can do this using AJAX in what is called inline editing.
Once the user types in the information into a field it is automatically stored into the database.
I have been trying to work out the kinks in a demo code that I found, but have not had much luck at it yet.
You can view the demo here and if you have any luck or idea's in getting it to work properly
Please let me know.
http:Q_24976285.html ( InLine Editing using AJAX)
Carrzkiss
If they had to put up with that box and its annoying noise, especially if you have a person
On your Form, that has his music turned up loud, that Dialog noise can take out your speakers.
You can do this using AJAX in what is called inline editing.
Once the user types in the information into a field it is automatically stored into the database.
I have been trying to work out the kinks in a demo code that I found, but have not had much luck at it yet.
You can view the demo here and if you have any luck or idea's in getting it to work properly
Please let me know.
http:Q_24976285.html ( InLine Editing using AJAX)
Carrzkiss
ASKER
"That dialog box would drive me nuts, I could imagine what your visitors would do/think
If they had to put up with that box and its annoying noise, especially if you have a person
On your Form, that has his music turned up loud, that Dialog noise can take out your speakers."
Sorry, but what are you talking about?
My website doesn't have any dialog boxes that play music. Also, I don't think I provided a link to my website in my post.
If they had to put up with that box and its annoying noise, especially if you have a person
On your Form, that has his music turned up loud, that Dialog noise can take out your speakers."
Sorry, but what are you talking about?
My website doesn't have any dialog boxes that play music. Also, I don't think I provided a link to my website in my post.
I take it you have not gone to the website provided be Mitchell?
http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
Check out the demo.
And it does not play music, you totally misread what what I wrote.
The link to the microsoft deal checks to see if you close the page, and if you do
It gives you a warning to let you know that you are trying to navigate away from the
Page, it is these types of things that most spam popup windows have.
Anyway, check out the link and you will see what I am referring too.
Carrzkiss
http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
Check out the demo.
And it does not play music, you totally misread what what I wrote.
The link to the microsoft deal checks to see if you close the page, and if you do
It gives you a warning to let you know that you are trying to navigate away from the
Page, it is these types of things that most spam popup windows have.
Anyway, check out the link and you will see what I am referring too.
Carrzkiss
ASKER
Ah ok, you were referring to the link provided by the other expert and not my website. Ok, sorry.
@MitchellVII: Did you tried the solution i suggested? Is it working fine for your requirements?
Thanks
Thanks
ASKER
qurv,
Thanks for asking.
I checked it but it is not working. I am using the following:
<body lang=EN-US onLoad="elmLoop();disableA utoComplet e('DocEPW_ IT_Group') " onbeforeunload="document.f orms[0].su bmit();">
<form method="post" id="DocEPW_IT_Group" action="scripts/asp/DocEPW _INSERT_IT _Group.asp " enctype="multipart/form-da ta">
But when the user navigates away from the page, the action is not firing as changes made are not being saved.
Thanks for asking.
I checked it but it is not working. I am using the following:
<body lang=EN-US onLoad="elmLoop();disableA
<form method="post" id="DocEPW_IT_Group" action="scripts/asp/DocEPW
But when the user navigates away from the page, the action is not firing as changes made are not being saved.
"But when the user navigates away from the page, the action is not firing as changes made are not being saved."
Are you saying that
onbeforeunload="document.f orms[0].su bmit();"
is not submitting the form?
Are you saying that
onbeforeunload="document.f
is not submitting the form?
ASKER
correct, it is not.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok, I'll try that. Gimme a day or so.
onbeforeunload event of body tag
See the following page for reference
http://msdn.microsoft.com/en-us/library/ms536907(VS.85).aspx
http://reference.sitepoint.com/html/extended-event-attributes/onbeforeunload#