Skip to Content
avatar image
Former Member

TextEdit UI element text area line separation

Hello,

I have a scenario where user has to input some data in a text area field and submit it.

Upon submission that data is to be displayed on different view as normal text.

I have used TextEdit UI element for this purpose and bound it to context attribute variable of type String.

Now when user enters Data in below format in textedit filed :

Line1 comes here,
Line2 goes here.

and press submit button,

It gets displayed in below format :

Line1 comes here,Line2 goes here.

But it should have got displayed in format in which user entered this data...i.e. with that line separation....

How can I make this possible.

Thanking you in anticipation

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Apr 18, 2011 at 07:21 AM

    Saurabh,

    I think you will have to insert a new line character explicitly in the attribute you use to store the text edit data (say TEdata)

    Declare a String and set its value to TEdata.

    Now iterate over the string and find the ASCII value of each character that has been typed and wherever it corresponds to an Enter , insert a new line character.

    Once done , assign the value of this string to TEdata.

    Hope this helps.

    Regards,

    Himanshu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Well I was wrong...

      TextEdit actually parses the new line character...

      The problem was that, I was trying to display text in HTML page....so I feel it was not able to parse the "\r\n"

      Thus I need to replace occurances of \r\n with BR.

      Edited by: Saurabh Agarwal on Apr 18, 2011 10:57 AM