RJS error: TypeError: element is null

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 %>

    <% 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 %>

Any help is appreciated.

Regards,

Salil G.

On 18 March 2010 15:33, Salil G. [email protected] wrote:

 render :update do |page|
   page.replace_html  'chat_area', :partial => 'chat_area', :object

=> [@chats, @user] if @js_update
end

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.

Colin

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.

Colin
Following div is present on my index.rhtml

<%= render :partial=>'chat_area' %>

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 G.

On 19 March 2010 07:04, Salil G. [email protected] 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 all

I 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

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 G.