Forum: Ruby on Rails how to eliminate replace_html alert pop-up in 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.
Tam K. (Guest)
on 2009-04-02 10:16
Hello,

I'm using RJS for AJAX call. Something like:

page["edit_single_client_div" + params["client_id"]].replace_html
:partial => 'client_single_display', :locals => {:the_client =>
SmsClient.valid.find_by_id(params[:client_id]), :recipients_session_id
=> params[:recipient_session_id]}


it works fine but sometimes the DIV doesn't exist on the page because
the user has paginated that piece of the page. the replace_html displays
Alert about that. I want to keep silent and just ignore the fact that
the DIV doesn't exist on page anymore.

Any ideas how to do that?

Thanks,

Tam
MaD (Guest)
on 2009-04-02 10:47
(Received via mailing list)
how about making it conditional? check existence of that div
beforehand.
Tam K. (Guest)
on 2009-04-02 11:52
Thanks MaD. Could you please provide a code on how to do this in RJS?

Thanks,

Tam
MaD (Guest)
on 2009-04-02 12:18
(Received via mailing list)
there is a similar thread:
  http://www.ruby-forum.com/topic/87505
This topic is locked and can not be replied to.