# RJS Templates

**URL:** <https://www.ruby-forum.com/t/rjs-templates/113848>\
**Category:** Rails\
**Created:** [September 5, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/rjs-templates/113848 "2007-09-05T15:22:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iain\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/6bbea6/32.png) [@Iain\_A](https://www.ruby-forum.com/u/Iain_A)\
**Post date:** [September 5, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/rjs-templates/113848/1 "2007-09-05T15:22:45Z")

</div>

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

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

 Message: \<%= text\_area 'message', 'message', "cols" =\> 60, "rows" =\> 3 %\> 
 \<%=submit\_tag 'Send' %\> 

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