Hi All, I got RJS error: TypeError: element is null while using ajax. I used in view <%= periodically_call_remote(:url=>{:action=>''get_user_list'', :id=>''1''}, :frequency => ''5'') %> in controller render :update do |page| page.replace_html ''chat_area'', :partial => ''chat_area'', :object => [@chats, @user] if @js_update end in partial chat_area <% if !@chats.blank? && !show_div(@chats).blank?%> <% show_div_id=show_div(@chats) %> <% for chat in @chats %> <div class="popup" id="chat_area_<%= chat.id %>" style="display:<%= (chat.id == show_div_id)? ''block'' : ''none'' %>;"> <% form_remote_for(:chat, :url => {:controller=>''chats'', :action=>''create'', :id=>1}, :html=>{:name => "form_#{chat.id}"}, :complete=>"resetContent(''#{chat.id}'');") do |f| %> <div style="display:none;"> <%= f.hidden_field :sessionNo, :value=>chat.sessionNo %> <%= f.text_area :chatContent, :id=> "chatContent_field_#{chat.id}", :cols=>"100", :rows=>"6", :onKeyPress=>"return submitenter(this,event);" %> </div> <input type="image" src="images/chat/send-hover.png" value="Send" onclick="return submit_button(''<%= chat.id %>'')"/> <% end %> </div> </div> <% end %> <% else %> <div class="popup" id="chat_area_none" style="display:''block'';"> <input type="image" disabled ="disabled" src="images/chat/send.png" style="cursor:default;" value="Send" /> </div> <% end %> Any help is appreciated. Regards, Salil Gaikwad -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 18 March 2010 15:33, Salil Gaikwad <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi All, > > I got RJS error: TypeError: element is null while using ajax. > > I used in view > > <%= periodically_call_remote(:url=>{:action=>''get_user_list'', :id=>''1''}, > :frequency => ''5'') %> > > in controller > > render :update do |page| > page.replace_html ''chat_area'', :partial => ''chat_area'', :object > => [@chats, @user] if @js_update > endI believe this is expecting to find a div with id chat_area to replace. I do not see this div in the code below, though I may be just not be seeing it. Colin> > in partial chat_area > > <% if !@chats.blank? && !show_div(@chats).blank?%> > <% show_div_id=show_div(@chats) %> > <% for chat in @chats %> > <div class="popup" id="chat_area_<%= chat.id %>" > style="display:<%= (chat.id == show_div_id)? ''block'' : ''none'' %>;"> > > <% form_remote_for(:chat, :url => {:controller=>''chats'', > :action=>''create'', :id=>1}, :html=>{:name => "form_#{chat.id}"}, > :complete=>"resetContent(''#{chat.id}'');") do |f| %> > <div style="display:none;"> > <%= f.hidden_field :sessionNo, :value=>chat.sessionNo %> > <%= f.text_area :chatContent, :id=> > "chatContent_field_#{chat.id}", :cols=>"100", :rows=>"6", > :onKeyPress=>"return submitenter(this,event);" %> > </div> > <input type="image" src="images/chat/send-hover.png" > value="Send" onclick="return submit_button(''<%= chat.id %>'')"/> > <% end %> > </div> > > </div> > <% end %> > > <% else %> > <div class="popup" id="chat_area_none" style="display:''block'';"> > <input type="image" disabled ="disabled" > src="images/chat/send.png" style="cursor:default;" value="Send" /> > </div> > <% end %> > > > > Any help is appreciated. > > > Regards, > > Salil Gaikwad > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> I believe this is expecting to find a div with id chat_area to > replace. I do not see this div in the code below, though I may be > just not be seeing it. > > ColinFollowing div is present on my index.rhtml <div id="chat_area"> <%= render :partial=>''chat_area'' %> </div> I don''t know what is the problem with this div or partial''s content while using same technique i am updating my other div''s Regards, Salil Gaikwad -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi All, I find it out why it happens because I didn''t close div above the "chat_area" properly. the only thing i did isclose the div and it works like a magic, neways thanks to all Reagrds, Salil Gaikwad -- Posted via http://www.ruby-forum.com/. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 19 March 2010 07:04, Salil Gaikwad <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi All, > > I find it out why it happens because I didn''t close div above the > "chat_area" properly. the only thing i did isclose the div and it works > like a magic, neways thanks to allI suggest installing the html validator add-in to Firefox and that will check the html of your pages as you develop them. This would have shown your missing /div immediately. Alternatively you can paste the html of the page into the w3c html validator for checking but this is much less convenient. Colin> > Reagrds, > > Salil Gaikwad > > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.