Text_area + render text issues

Hi,

I am having problems with text area and render :text and RJS used to
fill text area content.

I have a simple readonly text area in which I want to

  1. I use a periodic_update method to call update_status method every 5
    seconds which is supposed to update the contents of text area.
  2. Add text that the controller function returns - This could have \r\n
    and that should be shown as line break in text area.
  3. I should be able to update the content and not use replace_html from
    RJS since the content I want to display is xml.

Issue 1: The text area does not retain \r\n how do I force it to retain.
Issue 2: In RJS page(‘text_area’) << “RAW javascript” can retain ‘\r\n’
but can’t use a parameter sent into the RJS in “RAW Javascript” area.
Issue 3: page[‘text_area’].value = @text retains line breaks but this
does not allow for updates in a text_area this can only replace content.

Thanks for the help…

Regards,
Sudhindra

I had a similar problem. I expect users to enter html or xml in my
text area and I also wanted to retain line breaks when rendering a page.
The solution was quite simple

The html

 tag retained the line breaks and html_escape allowed me
to render the html. This is probably a rather large security hole but
I’m working on an internally facing application so it’s okay. The user
can now enter whatever they want in the textarea and it’s rendered
correctly when I display the data on another page.

When I render the text, it now looks like…

There should be a line break
here!