SetCharactersLimit
function SetCharactersLimit(nChars: number = null): boolean
Description
Sets a limit to the text field characters.
Parameters
- nChars
number
null The maximum number of characters in the text field. If this parameter is equal to -1, no limit will be set. A limit is required to be set if a comb of characters is applied. Maximum value for this parameter is 1000000.
Returns
boolean
Try It
var oDocument = Api.GetDocument();
var oTextForm = Api.CreateTextForm({"key": "Personal information", "tip": "Enter your first name", "required": true, "placeholder": "First name", "comb": true, "cellWidth": 3, "multiLine": false, "autoFit": false});
var oParagraph = oDocument.GetElement(0);
oParagraph.AddElement(oTextForm);
oTextForm.SetCharactersLimit(5);
oTextForm.SetText("John Smith");
var nLimit = oTextForm.GetCharactersLimit();
oParagraph = Api.CreateParagraph();
oParagraph.AddText("Characters limit: " + nLimit);
oDocument.Push(oParagraph);