Yellow Fade Technique After A Redirect?


I am having difficulty implementing the yellow fade technique after a
redirection. All the examples I have seen use it immediately after
editing an in-place form via Ajax. I would like to use it after
editing a form on a different page. Is it possible to do this in a
reliably cross-browser way?

To be specific, my index action shows a list of people. When you
click on a person you are taken to a new page to edit the person’s
details. When you have made your changes and submitted that form,
you are redirected back to the index action. I would like, at this
point, to highlight briefly the person who was just edited.

I can’t do an in-place form for editing the person right there on the
index page because the person model has many attributes and the
fields need an entire page to themselves to be legible.

Any help would be much appreciated.

Thanks and regards,
Andy S.

Put the person’s ID in the flash, and do thustly:

window.onload = function() {
new Effect.Highlight(‘domId_<%= flash[:person_id] %>’, {duration: 1,
startcolor: #cccccc, endcolor: #dddddd});

Should do the trick. This is all from my head and with the documentation
below. Of course, make changes as you need and see fit.


You could simply include the id of the record just edited in the
redirect back to the list. Then in the list view check for the
presence of that parameter and highlight the element with a matching id.

Building an e-commerce site with Rails?