Hi,
I am new to this RJS stuff. I want to make a page that has on it an inbox. I also want another box where the user can type a message. Then when a message is typed the inbox contains the new message and any others. Thus I need a periodical call to the server to check for new messages and a form with a text box to add a new message and look for new messages.
I made a normal template that looks like this
<div id="inbox">
</div>
<%= periodically_call_remote :url => {:action => 'update_inbox', :chatroom_id => @chatroom.id}, :update => 'inbox', :position => 'bottom', :frequency => 5 %>
<% form_remote_tag(:url=>{:action => 'post_message', :chatroom_id => @chatroom.id}, :update => 'inbox', :position=>:bottom) do %> <div id="message"> <label for"message_message">Message: </label> <%= text_area 'message', 'message', "cols" => 60, "rows" => 3 %>
<div class='buttonPanel'> <%=submit_tag 'Send' %> </div> </div>
<% end %>
This all works. Now I want to add an extra box to the page and update that when the submit button is used. Thus I thought RJS might be a better way to update everything.
Therefore my questions are:
1) Can you add html to an RJS template. 2) Can you add a periodical call to an RJS Template
Sorry it was so long winded just thought it would be better to add some background