Expand my Community achievements bar.

Comb

Avatar

Former Community Member
Hi, it's about comb. I just want to have a comb that not allow user to key in data more than the length set.
See attached pdf which is the sample testing for this.
comb.pdf
There are 2 parts in the pdf:

b 1st part:
A button with javascript to set a text field to comb with length of 5 when clicked.

Test result:
Clicked on the button and it set the text field to comb with length of 5.
am able to key in max. 5 characters as set. The text field is "locked" to prevent user to key in > 5 characters.

b 2nd part:
A text field with max length to 5 and tag is added in the XML source, under the text field.

Test result:
am able to key in > 5 characters(see attached). Bur when I clicked "enter", then the characters will be truncated to 1st 5 characters. Why? Do I need to set something?
e.g. to "lock" the comb so that user cannot type on it after it reached it's length?

---------------------------------------------------------------------
How to have a text field with combs initially ( not through click event) and prevent user key in data after reached it's limit.
Anyone knows how to make it? Thanks in advance..


Leia
3 Replies

Avatar

Former Community Member
Assume that the text field "TextField1" in page "P1" of form "F".



Just add the below script in
form initialize event in order to build comb field with length limit 5:



var oDoc = event.target;

var f = oDoc.getField("F[0].P1[0].TextField1[0]");

f.textColor = color.blue;

f.charLimit = 5;

f.comb = true;

f.strokeColor = color.black;



Regards,

Mei