NewLine (CR+LF) in textarea

NewLine (CR+LF) in textarea

Hi all,

We have an application with a textarea input field.
If I want to display the value in a (javascrip) alertbox , I get javascript errors

I want to replace in a string the CR+LF combination to avoid javascript errors.
Now I get a "unterminated string literal"  when trying to display the contents.

I've tried :
- Replace( textvar, NewLine(), "<br>" )
- Replace( textvar, Chr(13)+Chr(10), "<br>")
- Replace( textvar, "\n\r", '\\n\\r' )
- Replace( textvar, "\", '\\' )

No luck at all, please help ...

Hi Joop,

I suggest that you try
    Replace (textvar, Chr(13),"")
followed by
    Replace (textvar, Chr(10), "<br>")

Best regards
Have you tried the EncodeJavascript function?

Tiago Simões