You might want to try adding an observer to all form elements to detect when
the values change. For example:
var isDirty = false;
$$('input, textarea').invoke('observe', 'change', function()
{
isDirty = true;
});
-Hector
On Fri, Mar 27, 2009 at 3:22 PM, Stefano Esposito <
[email protected]> wrote:
>
> On Fri, 27 Mar 2009 16:55:58 -0500
> "Russell Keith" <[email protected]> wrote:
>
> > I have an iframe and I am using the onbeforeunload to prevent data
> > loss. What I need to do is set a variable called save to 0 after any
> > change is made within the frame.
> >
> >
> >
> > I tried this but it doesn't work:
> >
> >
> >
> > document.observe('change', function(){
> >
> > save=0
> >
> > });
> >
> >
> >
> > How can I accomplish this task? Is it possible to observe for any
> > change made?
> >
>
> I'm not sure of this, nor I've tested, but I'd try to observe
> keypress events.
>
> Ciao,
> Stefano
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---