I started working on a chat program but, I''m having this problem chatroom.rhtml <div id="chatroom"> </div> <%= periodically_call_remote( :update => "chatroom", :url => {:action => :chat }, :frequency => 2) %> chat.rhtml <h1><%= @chat.room %> room.</h1> <table border="5" bordercolor="darkred"> <tr><td><pre><%=h @chat.chat %></pre></td></tr> </table> but, when I call chatroom it dosn''t work but chat does, what is the problem here? -- Posted via http://www.ruby-forum.com/.
Mohammad wrote:> I started working on a chat program but, I''m having this problem > > chatroom.rhtml > <div id="chatroom"> > </div> > <%= periodically_call_remote( :update => "chatroom", > :url => {:action => :chat }, > :frequency => 2) %> > > chat.rhtml > <h1><%= @chat.room %> room.</h1> > <table border="5" bordercolor="darkred"> > <tr><td><pre><%=h @chat.chat %></pre></td></tr> > </table> > > but, when I call chatroom it dosn''t work but chat does, what is the > problem here?Can anyone help me with this I have to have my project done this week. -- Posted via http://www.ruby-forum.com/.
Mohammad wrote:> Mohammad wrote: > >>I started working on a chat program but, I''m having this problem >> >>chatroom.rhtml >><div id="chatroom"> >></div> >><%= periodically_call_remote( :update => "chatroom", >> :url => {:action => :chat }, >> :frequency => 2) %> >> >>chat.rhtml >><h1><%= @chat.room %> room.</h1> >><table border="5" bordercolor="darkred"> >><tr><td><pre><%=h @chat.chat %></pre></td></tr> >></table> >> >>but, when I call chatroom it dosn''t work but chat does, what is the >>problem here? > > > Can anyone help me with this I have to have my project done this week. >What does your chatroom action look like? -- Alex
loose :update in youre call and set an actual <div> to update the contents in youre controller. def chat @data = something render :update do |page| page.replace_html ''new'', @data end end now ''new'' is a <div> in youre chat.rhtml file with an id=''new'' or something more descriptive of course -- Posted via http://www.ruby-forum.com/.
I did what you said Peter but look at this, try { Element.update("data", "<h1>Welcome to chatroom Service</h1><br><br><table border=''2''><tr><td>Reminder: Please make sure the awnser is not in the \"FAQ\":/questions\r\nHaroon: I need help, my mail for actavation isn''t going out.\r\nAdmin: For *strong* secuirty we must ask you a couple of questions.\r\nHaroon: Okay.\r\nAdmin: On your contract it says \"ID #??\"\r\nHaroon: 982731\r\nAdmin: Your name.\r\nHaroon: Haroon.\r\nAdmin: Secuirty word:\r\nHarron: *Password has been blocked by admin*\r\nAdmin: Thank you, I will now look into it.</td></tr></table>"); } catch (e) { alert(''RJS error:\n\n'' + e.toString()); alert(''Element.update(\"data\", \"<h1>Welcome to chatroom Service</h1><br><br><table border=\''2\''><tr><td>Reminder: Please make sure the awnser is not in the \\"FAQ\\":/questions\r\nHaroon: I need help, my mail for actavation isn\''t going out.\r\nAdmin: For *strong* secuirty we must ask you a couple of questions.\r\nHaroon: Okay.\r\nAdmin: On your contract it says \\"ID #??\\"\r\nHaroon: 982731\r\nAdmin: Your name.\r\nHaroon: Haroon.\r\nAdmin: Secuirty word:\r\nHarron: *Password has been blocked by admin*\r\nAdmin: Thank you, I will now look into it.</td></tr></table>\");''); throw e } Thats what it show. Any clue what that means? Why is it not doing the HTML? Here is what my controller looks like: def chat @chat = Chat.find(:first) @data = RedCloth.new(I have done with and without this still the same) "<h1>Welcome to chatroom " + @chat.room + "</h1><br><br><table border=''2''><tr><td>" + @chat.chat + "</td></tr></table>" render :update do |page| page.replace_html ''data'', @data end end And here is my rhtml file. <div id="data"> </div> Any clues? -- Posted via http://www.ruby-forum.com/.