I'm looking for a way to validate that a user has entered a value matching either XXX-XX-XXXX or XX-XXXXXXX format. Ideally, the field will only allow numeric and "-" characters to be entered, but if that's too difficult...I could live with it simply ensuring that either format was entered (perhaps on the Exit event).
The script below seems to work HOWEVER it allows the user to enter the Tax ID with 8 digits following the "-" instead of a max of 7 digits. So basically, it accepts XX-XXXXXXX (9 X's) AND XX-XXXXXXXX (10 X's) and it shouldn't allow the latter.
var r = new RegExp();
var s = new RegExp();
var result = r.test(this.rawValue);
var result2 = s.test(this.rawValue);
if (result !== true & result2 !== true )
xfa.host.messageBox("Please enter your SS # in XXX-XX-XXXX format, or a Tax ID in XX-XXXXXXX format");