-3

I want to set 40 character per each line in textarea. Once the user enters 40 character he should comes to next line.

ketan
  • 19,129
  • 42
  • 60
  • 98
Ansuman
  • 23
  • 5
  • It seems that you forgot to ask a question. – Unihedron Aug 01 '14 at 13:22
  • Why are you trying to go to next line with a limited number of characters when Flex does that automatically for you? – Mansuro Aug 01 '14 at 13:23
  • There is a requirement like we have 3 desc1,desc2,desc3 column in db & a single text area i need to set first 40 charc to desc1,next 40 to desc2... – Ansuman Aug 01 '14 at 13:26
  • @Unihedron I thnk u din't undstnd my questn. hope to go through it again.. then reply – Ansuman Aug 01 '14 at 13:32

2 Answers2

0

I guess there is no straight way to do it, you have to listen to the change event or the textInput event, and check the number of characters, when the user reaches the limit you need, you can insert a new line in the text

Mansuro
  • 4,558
  • 4
  • 36
  • 76
  • Actually the thing is now m able to create 3 lines in textarea bt unable to restrict the no of character entered i.e 40 in each line – Ansuman Aug 01 '14 at 14:10
  • 2
    @Ansuman as I said above, you need to check the number of the characters when the user is writing the text – Mansuro Aug 01 '14 at 14:59
0

I seriously doubt you'll find ANY UI library which allows you to do this (easily). (If there is one, it'd only be able to do it by pure dumb luck and coincidence, because it's not a feature anyone needs.) You'd have to use some messy solution which counts characters and parses/inserts newlines manually. I highly recommend finding an alternative solution and getting this entire requirement re-written, I've never even heard of such a requirement.

Also it sounds like you might have a major database design issue if you're trying to put individual lines of text into separate columns in a db.

If not, instead of doing a single text box, use a repeater or some number of separate TextInputs and have the user enter data in each field separately. You can limit the number of characters to 40 for each field easily.

User
  • 293
  • 3
  • 19