2 Replies Latest reply on Feb 29, 2012 8:51 PM by Srikanth V

    Number of lines in multiline text field

    Srikanth V



      Is there a way to find mumber of lines being typed by the user in multiline text field?

      I tried to split the text in change event but did not help. Please provide a sample to solve this.




        • 1. Re: Number of lines in multiline text field
          Srini Dhulipalla Level 5

          You can use the Exit event of the TextField to test..

          Only if the user uses enter key then a new line character is added to the field.

          If the user enters the text without using enter key to goto next line, then the field will wrap the text and without a new line character. In that case, it will be treated as a single line.


          var xx = TextField1.rawValue.split(/\r\n|\r|\n/);

          xfa.host.messageBox("" + xx[i]);




          • 2. Re: Number of lines in multiline text field
            Srikanth V Level 1

            Hi Srini,


            Thanks for your answer. I tried this option as well.

            I wanted to limit the number of lines a user types in the textfield. The text wraps around the field and it will be always a single line if user wont press an enter key. I wanted to calculate the no of fields at runtime while user is still typing the text.


            Could you please let me know if it is possible.