I'm sure this is possible (at least it is)...I'm trying to assign two patterns to one field...so for instance, if a field asks for a social security number OR Tax ID, it will accept the social in XXX-XX-XXXX format OR the Federal Tax ID in XX-XXXXXXX format. I tried using the Pattern UI in LiveCycle panel under the validation and display tab as text{999-99-9999}|text{99-9999999} to no avail.
I also tried playing around with a reg expression on an Exit event to no avail (see below): Actually, I got it to work for one expression, but not the other.
var r = new RegExp();
r.compile("[0-9]{3}\-[0-9]{2}\-[0-9]{4}");
var s = new RegExp();
s.compile("[0-9]{2}\-[0-9]{7}");
varresult = r.test(this.rawValue);
varresult2 = s.test(this.rawValue);
if (result !== true | result2 !== true )
{
xfa.host.messageBox("Please enter a SS # in XXX-XX-XXXX format or a Tax ID in XX-XXXXXXX format");
}
Is it possible to combine two (2) Reg expression strings using an OR "I" notation? perhaps, something like:
varr = new RegExp();
r.compile("[0-9]{3}\-[0-9]{2}\-[0-9]{4}" | ""[0-9]{2}\-[0-9]{7}");
Any suggestions/assistance is greatly appreciated.
Thanks in advance.
Views
Replies
Total Likes
Hi,
Would this not work
var r = new RegExp();
r.compile("([0-9]{3}\-[0-9]{2}\-[0-9]{4}|[0-9]{2}\-[0-9]{7})");
Regards
Malcolm
Views
Replies
Total Likes