This is a migrated thread and some comments may be shown as answers.

Multiline Textbox converts line feeds to BR HTML tags

1 Answer 114 Views
Input
This is a migrated thread and some comments may be shown as answers.
Condorito
Top achievements
Rank 1
Condorito asked on 01 May 2012, 11:03 PM
Hi,  I'm using Telerik web controls version 2012.1.215.35.  I have a RadTextBox with the TextMode property set to "MultiLine"  

<telerik:RadTextBox runat="server" InputType="Text" ID="rtbSearch" Width="500px" TextMode="MultiLine"  Rows="5" EmptyMessage="Please enter numbers, maximum of 5, one per line."></telerik:RadTextBox>

A button then calls some JavaScript code that retrieves the value of the RadTextBox using get_textBoxValue() and sends it over to a different page as a QueryString. I noticed however that it converts any line feeds like this:

12345
67892
01234 

to this:

12345<br>67892<br>01234

which causes an issue since the receiving page is expecting a line feed (Chr(10) + Chr(13)) and not HTML tags to separate the values.  How can I prevent this?  Thank you.

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 03 May 2012, 07:23 PM
Juan:

I'd suggest you reference this post for some insights on working with line breaks in JavaScript.

You should be able to reformat your string using a regular expression, as follows, prior to feeding it to the QueryString:

theString.replace( '<br />', /\n|\r/g )

I hope this helps!
Tags
Input
Asked by
Condorito
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or