Hi,
I need check if people insert in correct format a number in text field: 123.456.789-00. With the below script ON INPUT of the FIELD I do it with success. I also need to check that people insert 11 characters not less (up to 14), because with this wrong behaviour script return an error.
Any suggestion?
Thanks
Mic
if (input.FIELD != "")
{
FIELDFormat = (input.FIELD).replaceAll("^[0-9]{3}.[0-9]{3}.[0-9]{3}-[0-9]{2}","correct");
tFIELD = (((((((input.FIELD ).subString(0,3)) + ".") + (input.FIELD ).subString(3,6)) + ".") + (input.FIELD ).subString(6,9)) + "-") + (input.FIELD ).subString(9,11);
if (FIELDFormat != "correct")
{
input.FIELD = tFIELD ;
}
}