Hi,
I have following code in the  html.
<div id="add_a_tag_error"
style="display:none;"> </div>
In case there is an error then following code gets executed.
if @error
  page[:add_a_tag_error].replace_html "<div
id=''add_a_tag_error''><br
/>#{@error_message}</div>"
  page[:add_a_tag_error].show
end
Using firebug I noticed that following response is being sent.
try {
$("add_a_tag_error").update("<div
id=''add_a_tag_error''><br />Error.
try again!</div>");
$("add_a_tag_error").show();
} catch (e) {
But I don''t see the error message on the browser.
However if I only execute this line the I see the error message (
given that I change   to something else)
page[:add_a_tag_error].show
It seems to me that AJAX will not work in the case of replace followed
by show. Anyone knows how to fix this issue:?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
replace_html replaces the content of the element, not the entire element itself.
you want to do:
page[:add_a_tag_error].replace_html "<br/>#{@error_message}"
page[:add_a_tag_error].show
which will result in:
<div id="add_a_tag_error"><br/>Error try
again!</div>
the way you were doing it, the results would have been
<div id="add_a_tag_error" style="display:none">
  <div id="add_a_tag_error"><br/>Error try
again!</div>
</div>
you have 2 divs with the same id.
Chris
On 1/5/07, Neeraj Kumar
<neeraj.jsr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Hi,
>
> I have following code in the  html.
>
> <div id="add_a_tag_error"
style="display:none;"> </div>
>
> In case there is an error then following code gets executed.
>
> if @error
>
>   page[:add_a_tag_error].replace_html "<div
id=''add_a_tag_error''><br
> />#{@error_message}</div>"
>   page[:add_a_tag_error].show
>
> end
>
> Using firebug I noticed that following response is being sent.
>
> try {
> $("add_a_tag_error").update("<div
id=''add_a_tag_error''><br />Error.
> try again!</div>");
> $("add_a_tag_error").show();
> } catch (e) {
>
> But I don''t see the error message on the browser.
>
> However if I only execute this line the I see the error message (
> given that I change   to something else)
> page[:add_a_tag_error].show
>
> It seems to me that AJAX will not work in the case of replace followed
> by show. Anyone knows how to fix this issue:?
>
> Thanks.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Neeraj Kumar
2007-Jan-05  18:56 UTC
Re: AJAX issue: replace followed by show is not working
Thanks Chris. That solved the problem. - Neeraj On 1/5/07, Chris Hall <christopher.k.hall-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > replace_html replaces the content of the element, not the entire element itself. > > you want to do: > > page[:add_a_tag_error].replace_html "<br/>#{@error_message}" > page[:add_a_tag_error].show > > which will result in: > > <div id="add_a_tag_error"><br/>Error try again!</div> > > the way you were doing it, the results would have been > > <div id="add_a_tag_error" style="display:none"> > <div id="add_a_tag_error"><br/>Error try again!</div> > </div> > > you have 2 divs with the same id. > > Chris > > On 1/5/07, Neeraj Kumar <neeraj.jsr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi, > > > > I have following code in the html. > > > > <div id="add_a_tag_error" style="display:none;"> </div> > > > > In case there is an error then following code gets executed. > > > > if @error > > > > page[:add_a_tag_error].replace_html "<div id=''add_a_tag_error''><br > > />#{@error_message}</div>" > > page[:add_a_tag_error].show > > > > end > > > > Using firebug I noticed that following response is being sent. > > > > try { > > $("add_a_tag_error").update("<div id=''add_a_tag_error''><br />Error. > > try again!</div>"); > > $("add_a_tag_error").show(); > > } catch (e) { > > > > But I don''t see the error message on the browser. > > > > However if I only execute this line the I see the error message ( > > given that I change   to something else) > > page[:add_a_tag_error].show > > > > It seems to me that AJAX will not work in the case of replace followed > > by show. Anyone knows how to fix this issue:? > > > > Thanks. > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---