5 Replies Latest reply on Dec 28, 2007 7:13 AM by kglad

    Restricting TEXTAREA component to lines.

      Hi All,

      I wanna restrict user entry to certain no of lines in my textarea component. Ho can i do this? I havent seen any relevant API's for this in the help. Should i do this totally programatic way?? Can anyone give me a hint?...
      I can restrict characters and the requirement spec needs to restrict lines too, say 16 lines.

      Regards
      Roshan
        • 1. Re: Restricting TEXTAREA component to lines.
          kglad Adobe Community Professional & MVP
          use a change listener to check the maxVPosition and if, it's greater than whatever you want, use the string methods to truncate the text property of your textarea.
          • 2. Re: Restricting TEXTAREA component to lines.
            Level 1
            Hi Kglad,

            I used the change listener as you told and im able to trace the enter click now. I can get the 16 enter clicks. Now the main part where im stuck is,...

            What do i do after tracin 16 enter clicks? The user shouldn't be allowed to type further, but he can edit the ones he typed. How do i do this now? I cant disable the textarea, this stops user entry and user edit too. How can i give to requirement of 'no going forward' but play there.??

            Regards
            Roshan
            www.3dnirvana.blogspot.com
            • 3. Re: Restricting TEXTAREA component to lines.
              kglad Adobe Community Professional & MVP
              how many lines fit in your textarea? or, what's the maximum number of lines of scrolling that you want to allow?
              • 4. Re: Restricting TEXTAREA component to lines.
                Level 1
                quote:

                Originally posted by: kglad
                how many lines fit in your textarea? or, what's the maximum number of lines of scrolling that you want to allow?


                Hi Kglad,

                I have to restrict my textArea component to 16 lines. Even if a single char is represented per line, it sould take only 16 lines whatsoever.
                I have restricted the no of chars to 572, which was there in the requirement. Now i'm left with this probs.
                Hope I can get it done..

                Reagards
                Roshan Kolar


                • 5. Re: Restricting TEXTAREA component to lines.
                  kglad Adobe Community Professional & MVP
                  you appear locked into a way of thinking about this problem that's preventing your from seeing an easy solution:

                  you can directly access the number of lines in an input textfield. in a textarea, you can access the number of lines that can't be viewed in your textfield but must be scrolled to be viewed. so, if you have a textarea that displays less than 16 lines, you only need to know how many lines it can display (without scrolling) and use its maxVPosition to determine how many lines contained in your textarea.