You have a textarea and you're rendering the text you get from it on a page.
Textarea Input:
This is on the first line.
This is on the second line.
This is on the third.
Browser Output:
This is on the first line.This is on the second line.This is on the third.
Now that sucks.
@string = $F(TextAreaId).value
@string = CGI.unescape(@string).gsub(/\n/,"<br />")
And you're done!
PS: $() is prototype.js for getElementById()
"They make you drink your blood,
and tear yourself to pieces!"
Accept - Balls To The Wall
4 Responses to Ruby on Rails retaining newline from a textarea
What?
This is the first line
This is the second line.
This is the third line.
Is this what you computer engineers do?
OK.
This is the 8th line
This is the 9th line
This is the 10th line.
Am I also a computer engineer now?
Nonsense.
Oh...God...cannot...control...myself....must..leave..embarassing message....about....the.....fact that..I...think....you...are the..BOMB!
so, you seem to have not updated your blog in a while. You are a tease, after having piqued my curiosity in "Ruby retaining newline from a text area" you have vanished, leaving me bereft in this cruel "retaining newline from text area" arena.
I hate you....:-D
tnxs for the ideia !
Something to say?