> I've been handed a new design for an edit view with a form, that
> allows the user to move on to the next object in a list. This means
> that there could be pending edits that need to be saved. The design
> called for wants a prompt to see if the user wants to save or discard
> pending changes (ala Gmail).
>
> What's a good rails-y way to do this?

Doubt Rails would get involved much as this has to happen client side  
(the user could go anywhere or click on anything right?)

I'd write some Javascript to loop through all the fields in the form  
and create another attribute "original-data" -- using whatever the  
recommended naming scheme is... maybe it's data-original, I don't  
recall.

Set the current value to this attribute.  Then add an onunload handler  
that checks to see if any changes have been made and if so warn the  
user.

-philip

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

Reply via email to