Forum: Ruby on Rails using replace_html and fade with rjs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F677fa685a2cfe8aff31f161062db3d3?d=identicon&s=25 David (Guest)
on 2008-11-25 09:48
(Received via mailing list)
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?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-25 10:31
(Received via mailing list)
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
This topic is locked and can not be replied to.