I have a unique pattern for a DOB field. If the user doesn't enter the correct pattern, a message pops up and the focus is set to the field - see script below. This works perfect for me, but not my users. I'm using Adobe LiveCycle ES with Adobe Acrobat 7.0 and they are using Adobe Reader 9.0. Why would this make a difference?
form1.#subform[0].DOB::exit - (JavaScript, client)
var
r = new RegExp("^[0-9]+\\/[a-zA-Z]{2}+\\/[0-9]");
var
result = r.test(this.rawValue);
if
(result == true) {
true
}
else
{
app.alert("Please enter a valid Date of Birth: DD/Mo. Code/YY; e.g. 26/JA/67");
xfa.host.setFocus("DOB");
}
Views
Replies
Total Likes
Hi,
the regular expression seems to be invalid.
The console throws an error with the one you use.
Try this one:
var r = new RegExp(/^\d{1,2}\/[a-zA-Z]{2}\/\d{2}$/);
var result = r.test(this.rawValue);
if (result !== true)
{
xfa.host.messageBox("Please enter a valid Date of Birth: DD/Mo. Code/YY; e.g. 26/JA/67");
xfa.host.setFocus(this);
}
Views
Replies
Total Likes
This worked - thanks so much for your help!
Views
Replies
Total Likes