Hi everybody ! I''m newbie to rails. I have a problem to display the Textarea. As I got some value from mysql database and load this value in a text area. By defualt the scroll bar for the text area is at the top like in browsers. But I want the scroll bar of the text area at the bottom like in yahoo & gmail chats ( I mean I want to see the last line of the textarea at first. If want to see the first line, then I have to scroll to the top.) Is it possible. The code I used for the textarea as follows. <textarea name="msg" rows=30 readonly style="width: 50%;" > <% @message.each do |ms| %> <%= ms.content -%> <%end%> </textarea> Where @message = Message.find(:all) Thanks in advance. Regards, Veeraa. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi! Just googled and found this on another discussion forum, nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight; Hope this helps, Thanks and regards, Swanand On 4/30/07, Veera Sundaravel <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hi everybody ! > > I''m newbie to rails. I have a problem to display the Textarea. > > As I got some value from mysql database and load this value in a text > area. > By defualt the scroll bar for the text area is at the top like in > browsers. But I want the scroll bar of the text area at the bottom like > in yahoo & gmail chats ( I mean I want to see the last line of the > textarea at first. If want to see the first line, then I have to scroll > to the top.) > > Is it possible. The code I used for the textarea as follows. > > <textarea name="msg" rows=30 readonly style="width: 50%;" > > > <% @message.each do |ms| %> > > <%= ms.content -%> > > <%end%> > > </textarea> > > > > Where @message = Message.find(:all) > > > Thanks in advance. > Regards, > Veeraa. > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Swanand Deodhar wrote:> Hi! > Just googled and found this on another discussion forum, > nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight; > Hope this helps, > > Thanks and regards, > SwanandHi swanand! Thanks for your great help. Thanks lot for getting this info by spending your valueable time for me. Thanks with regards, Veeraa. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Veera Sundaravel wrote:> Swanand Deodhar wrote: >> Hi! >> Just googled and found this on another discussion forum, >> nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight; >> Hope this helps, >> >> Thanks and regards, >> Swanand > > Hi swanand! > > Thanks for your great help. Thanks lot for getting this info by spending > your valueable time for me. > > Thanks with regards, > Veeraa.Hi swanand ! I used like this both as follows <script language="javascript"> ch1.scrollTop = ch1.scrollHeight; </script> and <% language="javascript"> ch1.scrollTop = ch1.scrollHeight; %> in my .rhtml file . But doesn''t work. Any other suggestion. Regards, Veeraa... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi! Can you please check if you are getting any JS error? Since according to http://developer.mozilla.org/en/docs/DOM:element.scrollTop http://developer.mozilla.org/en/docs/DOM:element.scrollHeight the current code should work Thanks and regards, Swanand. On 4/30/07, Veera Sundaravel <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Veera Sundaravel wrote: > > Swanand Deodhar wrote: > >> Hi! > >> Just googled and found this on another discussion forum, > >> nameofyourtextarea.scrollTop = nameofyourtextarea.scrollHeight; > >> Hope this helps, > >> > >> Thanks and regards, > >> Swanand > > > > Hi swanand! > > > > Thanks for your great help. Thanks lot for getting this info by spending > > your valueable time for me. > > > > Thanks with regards, > > Veeraa. > > > Hi swanand ! > > I used like this both as follows > > <script language="javascript"> ch1.scrollTop = ch1.scrollHeight; > </script> > > and > > <% language="javascript"> ch1.scrollTop = ch1.scrollHeight; %> > > in my .rhtml file . But doesn''t work. Any other suggestion. > > > Regards, > Veeraa... > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---