Apologies in advance ...this may be a really dumb question but here goes. @formatted_question[:a] contains text with HTML markup. I want to display it in a field so I can control its vertical and horizontal size on the page. When it is displayed on the page now, rather than interpreting the HTML, it is output into the text field as a string with all HTML tags showing. What am I doing wrong?? <div id = "A"> <%= text_area_tag id="cka",(@formatted_question[:anno_a]) %> </div> Any help would be greatly appreciated -- 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Sun, Jan 27, 2013 at 11:31 AM, Dave Castellano <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> @formatted_question[:a] contains text with HTML markup. I want to > display it in a field so I can control its vertical and horizontal size > on the page. When it is displayed on the page now, rather than > interpreting the HTML, it is output into the text field as a string with > all HTML tags showing. What am I doing wrong??Misusing a form element :-)> <div id = "A"> > <%= text_area_tag id="cka",(@formatted_question[:anno_a]) %> > </div>That''s the way a text area works; if you want to control display size, use CSS to size the appropriate block-level container (e.g. div, p). -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On Jan 27, 2013, at 3:04 PM, Hassan Schroeder wrote:> On Sun, Jan 27, 2013 at 11:31 AM, Dave Castellano <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > >> @formatted_question[:a] contains text with HTML markup. I want to >> display it in a field so I can control its vertical and horizontal size >> on the page. When it is displayed on the page now, rather than >> interpreting the HTML, it is output into the text field as a string with >> all HTML tags showing. What am I doing wrong?? > > Misusing a form element :-) > >> <div id = "A"> >> <%= text_area_tag id="cka",(@formatted_question[:anno_a]) %> >> </div> > > That''s the way a text area works; if you want to control display size, > use CSS to size the appropriate block-level container (e.g. div, p). > > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassanAlso, you need to indicate that the contents should not be escaped, but delivered as-is to the page: <div id="cka"> <%=raw @formatted_question[:anno_a] %> </div> Note the ERB tag begins "<%=raw" That ''raw'' is http://apidock.com/rails/ActionView/Helpers/OutputSafetyHelper/raw and will send the actual contents, i.e., the HTML, to the page. -Rob -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.