away
from a page without submitting. I am having issues when the page uses
document.add to overwrite radio buttons and textboxes. Everything else
works. What doesn't work is when the user clears a textbox or radio
button. The way it gets cleared is with document.add. I want to
include this segment of code on multiple pages, so it must be dynamic.
Here is what I have so far:
var warnMessage = "You have
unsaved changes on this page!";
$(document).ready(function() {
$(document).live('change',
':input', function () {
$('form*').add(function() {
alert("wassup son");
});
window.onbeforeunload = function
() {
if (warnMessage != null)
return warnMessage;
}
});
//DOESN'T SHOW WARNING
MESSAGE IF SUBMIT BUTTON IS PRESSED
There are ~200 or so pages that need this leave page warning and just
including it would be the easiest. I removed the lines that you
said I wouldn't need and it still works somewhat. It still won't
give the warning if the radio buttons are replaced by new ones.
That works but, I don't want to edit the clearRadio function.
doucment.add gets used all throughout the software all the time.
So if I don't have to change all the document.add's I don't want to.
Edit: I have updated all the clearRadio functions in the software..
Now I have to figure out how to do all the other document.add's (all
12,091 of them)
You don’t have to do anything. But If you want the clear code to trigger
the change code, you need to do something. Changing the function is the easiest.
I hope all your little functions like clearRadio are together
in a nice file somewhere and not copied and pasted into each of the
200 pages.
When the
button associated to the delete2 img is pressed it needs to clear the
dx1 textbox and trigger change. Same with the button associated with
the search2 img. Thanks for the help!