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
[email protected]? && !show_div(@chats).blank?%
<% show_div_id=show_div(@chats) %
<% for
chat in @chats %
"
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| %
<%= 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);" %
')"/
<% end %
</div>
<% end %
<% else %
<% end %
My div present in index.html.erb
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody><tr>
<td align="left" width="80%" valign="top" style="">
<%= text_area :chat, :chatContent, :id=> "chatContent_field", :cols=>"100", :rows=>"6" %>
</td>
<td align="left" width="20%" valign="bottom" style="padding-left:10px;padding-left:10px;x" >
<div id="chat_area">
<%= render :partial => 'chat_area' %>
</div>
</td>
</tr>
</tbody>
</table>
Any help is appreciated.
Regards,
Salil Gaikwad