[ic] Warn before navigating away if form data not submitted ?

DB DB at M-and-D.com
Fri May 21 00:47:32 UTC 2010


>> I'm seeking a way to warn a user if they attempt to navigate away from a
>> page which has form data that's not yet been submitted. A javascript
>> popup for example would do the trick, or maybe there's a way to do this
>> using an IC trick? I'd welcome any thoughts or ideas.
> Some untested Javascript:
> 
> 	<script type="text/javascript" charset="utf-8">
> 		var formChanged = 0;
> 		var submitted = 0;
> 		window.onbeforeunload = function () {
> 			if (!submitted && formChanged) {
> 				return "You have unsaved changes.";
> 			}
> 			return;
> 		}
> 	</script>
>  
> 
> <form onsubmit="submitted = 1;">
> 	<input name=somefield onchange="formChanged = 1;">
> 
> </form>
> 
> Bill Carr 
> Bottlenose - Wine & Spirits eBusiness Specialists 
> (413) 584-0400 
> http://www.bottlenose-wine.com 

Seems to do the job - thanks!

DB



More information about the interchange-users mailing list