I have a php based checklist that stores the answers to MSSQL. Currently it has a save button at the bottom of the page that no one uses. When they exit the page without pressing save no data is recorded. Is it possible to have a prompt that would ask to save, when they try to leave? Any is help is appreciated. thanks
Save Prompt for PHP form?
Collapse
X
-
Tags: None
-
Thanks for the info. I am now able to warn them at least. Has anyone seen it where the save function can be in the prompt?Comment
-
my form has a simple submit button to save the data
<input type="submit" value="Save">
by using onbeforeunload I get the prompt "You are leaving the page....Are you sure you want to navigate away". "OK" or "Cancel"
Is it possible to have it say "you are leaving the page....do you wish to save this page before leaving." and when they click on 'OK" it saves the page before leaving.
Here is the javascript:
<script language="JavaS cript">
window.onbefore unload = confirmExit;
function confirmExit()
{
return "If you have made any changes without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
}
</script>Comment
Comment