Take a look at Form.Observer -- it's ideal for this sort of thing. It  
watches the form in a tight loop (at your specified interval) and if  
there are any changes to the form from the last time, it fires a  



On Mar 29, 2009, at 8:55 PM, RobG wrote:

> On Mar 28, 7:55 am, "Russell Keith" <russell.ke...@aacreditunion.org>
> 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
>>             });
> The change event doesn't bubble, so that won't work.
>> How can I accomplish this task?  Is it possible to observe for any
>> change made?
> If a control's value is equal to its defaultValue, then it hasn't
> changed.  That strategy accounts for the case where a user modifies
> the value, but sets it back to its original value before submitting
> the form.
> You can attach a listener to the unload handler to check all form
> controls to see which are different from their default value when the
> form is submitted or the page closed - test it well, there are many
> foibles with whatever solution you choose.
> --
> Rob
> >

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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to