Avatar

Level 5

Hi,

please use this script in the exit-event of your textfield:

var nValueLength = this.rawValue;

if(nValueLength.length < 5)

{   

    xfa.host.messageBox("Please enter 5 digits.", "User Information", 1,0);

    this.rawValue = null;

}

Please set the following setting in object | field | limit length max chars 5.

If you need a script that allows only numbers in a textobject use the following in the change-event:

if(xfa.event.newText.match(/[^0-9]/))

{

    xfa.event.change = "";

}

That's all. Hope it will helps you,

Mandy