Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

determine the number of lines of textfield or floating field

Ruytero-HzmPcE
Level 4
Level 4
Hi,



Is there a way to determine the number of lines of text in a textfield or in a floatingfield.



My problem is that I'm creating a form with three tables(made of subforms) underneed each other that needs to be set to hidden when the total of rows is greater than 25.

Now it would be easy to just count the rows but these rows can exist of multiple lines of text.

The fields of my row are floating fields so when the text is bigger than the displayable width the text continous on a new line in the same row. So I need to know when this happens because now I can show only 24 rows.



I tried counting the characters but this doesn't work, when there are a lot of 'i,j,l' or other small characters I can place 40 characters in my textfield, but when there are a lot of 'm,w' characters I can place only 22 characters in my field.



I also tried to use xfa.layout.h(TextField1,"cm") to determine the height of the field, but it always retuns the value -1. I get the same -1 with the y or x - position.



Does anybody have an idea how to solve this problem?



Thanks in advance,



RonnyR
2 Replies
Not applicable
ronny,



were you ever able to figure out how to count the lines in a text field?



if so, how did you do it?



thanks,

david
Not applicable
oops ... i got it thanks.



code below -----



for(var i=0; i <= s.length-1; i++)

{

sCurrentLetter = s.substring(i,i+1);

if (s.charCodeAt(i) == 13)

{

// this is a line break

}

}