Expand my Community achievements bar.

SOLVED

event when text does not fit in field

Avatar

Level 4

Hi

when there is not enough room for the text in a field. Reader will show a little '+'. Is there any way to listen for this as an event og something similiar??

I have a field with room for 3 linies. If the user enters more. I need to put the extra in anoter field.

I have logic that look for number of linies - I do a split for '\r' and get each line in an array. BUT the linies can be long, som if the just enter 1 long line, my logic does not work. My font is NOT monospaced, so I know how long a linie will be!

Let me hear if anybody have solved a case like this

Thanks

Thomas Groenbaek, Jyske Bank, Denmark

1 Accepted Solution

Avatar

Correct answer by
Level 7

If you check the "Limit Length to Visible Area" checkbox on the field, the full event will trigger once the user fills up the field. You could put in a script like:

xfa.host.setFocus(form1.subform1.overFlowTextField);

in the full event of the field with room for only 3 lines. Be aware though, that the focus change is not instantaneous and that a character or two could be lost, especially if the user is a fast typer. For this to work you must have "Limit Length to Visible Area" checked.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

If you check the "Limit Length to Visible Area" checkbox on the field, the full event will trigger once the user fills up the field. You could put in a script like:

xfa.host.setFocus(form1.subform1.overFlowTextField);

in the full event of the field with room for only 3 lines. Be aware though, that the focus change is not instantaneous and that a character or two could be lost, especially if the user is a fast typer. For this to work you must have "Limit Length to Visible Area" checked.

Avatar

Level 4

Nice way to make it work. I expect that it will be ok to jump to new page, when needning extra space for text

thanks

/Thomas

Avatar

Level 7

Jumping to a new page won't be a problem, but the script I posted assumes you know the path to the field you're placing the overflow text into. For example, if your first (limited) field is on page 1 (which I'll call subform1) and the field accepting the overflow text is on page 2 (which I'll call subform2) then the script on the limited field would be:

xfa.host.setFocus(form1.subform2.overFlowTextField);

As long as the path is correct to the overflow field you'll be fine.