Using replace_html and fade with rjs

I have run into a problem using replace_html and fade together to
display an error message. The error message is displayed when a user
enters the wrong username or password and then fades away. The
problem is that if a user enters incorrectly again, the error is not
displayed again. I need someway of resetting the html element so that
I can replace it again. Here is the relevant code:

format.js do
render :update do |page|
page.form.reset ‘login_form’
page.visual_effect(:fade, “login_error”, :duration => 2)
page.replace_html ‘login_error’, “Username and password do not
match.”
end
end

any ideas?

On 25 Nov 2008, at 08:47, David wrote:

I have run into a problem using replace_html and fade together to
display an error message. The error message is displayed when a user
enters the wrong username or password and then fades away. The
problem is that if a user enters incorrectly again, the error is not
displayed again. I need someway of resetting the html element so that
I can replace it again. Here is the relevant code:

fading eventually marks the corresponding dom element as invisible.
You’ll need to show it again (page.show etc…)

Fred