Something like this will work.
// form1.page1.subform1.productID::exit - (JavaScript, client)
if (form1.page1.subform1.productID.isNull) {
xfa.host.messageBox("The product ID is a mandatory field.");
}
else {
var productID = this.rawValue;
if (productID.length != 4) {
xfa.host.messageBox("The product ID must be four characters in length.");
}
}
This code assumes the product ID is a mandatory field.
Steve