This is the basics of what I use now...

function check_form_data_for_unload(event_obj)
{
  var form_data_message = "You have unsaved data.";

  if (window.form_changed) {
    if (event_obj)
      event_obj.returnValue = form_data_message;
    else
      return form_data_message;
  }
}

window.form_changed = false;
window.onbeforeunload = check_form_data_for_unload;

If I change a form value, I simply set form_changed to true.  I do a
bit more than what I show here, but this should be good enough to get
you started.

On 11/12/07, ditman <[EMAIL PROTECTED]> wrote:
>
> First things first: Hi all! I've been sucked into prototype and
> script.aculo.us develpment thanks (because of?) the Symfony PHP
> framework...
>
> I'd like to implement a feature on some admin pages, but I can't seem
> to find the right search term to google it; I want to ask the user to
> confirm exit of a page, if she has changed anything on the forms
> displayed on it.
>
> I have some knowledge in other JS frameworks (did some things in
> Mootools) but for this thing I don't know where to start.
>
> Any advice would be greatly appreciated :)
>
> Thanks!!
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to