In my first attempt at Ajax, I had a very easy time implementing a
highlight effect using form_remote_tag. That was a one page form that
rendered everything on that one page.
I am stuck on how to implement the highlight effect if there is a
redirect involved. Let me use the example of the the "Guess What" game
from the Ajax chapter in the Rails book on page 379 where you must end
the phrase "Ruby on ...". If you successful guess it, it will give you
a highlighted "You''re right" on the same page, while if you
are wrong
then it highlights "It seems ''x'' is hardly the correct
answer".
That example is very easy to implement and understand. But let''s say
if I submit the right answer (like a password), I am to be redirected
to another page (an account page), but if I am wrong I should stay on
that page and get the highlighted error message. I can''t figure out
how to do that. Using the form_remote_tag, all redirects get rendered
in the update div.
>From poking around and reading, it seems like the answer may lie in
using the eval(request.responseText), but there are not a lot of
examples. I''ve experimented with conditional effect.highlights, but
can''t get it to work.
Any suggestions or links to implementations are appreciated.
Steve