


This code is flagging all legimate email addresses regardless of what I enter upon the "Exit" event of the field. I only wish the code to flag those email addresses that don't end in @metalworks.com. Does anyone spot the error or what I am missing? Thanks.
var r = new RegExp("^[a-z0-9_\\-\\.] + \\@metalworks.com");
var result = r.test(form1.Page1.Document.OnethruTen.OneThruFour.Four.ResponsibleEmail.rawValue);
if (result == true) // If it fits the general form,
{}
else
{
form1.Page1.Document.OnethruTen.OneThruFour.Four.ResponsibleEmail.rawValue = "";
xfa.host.messageBox("You have entered an invalid Email address. \nAll email addresses must end in '@metalworks.com'.","Email Verification", 4, 0)
}
;
Views
Replies
Sign in to like this content
Total Likes
Make sure your Regular expression string doesn't have any spaces in it.
Also, for your if statement, you can change your condition to if (result==false) that way you don't need an empty execution block {}.
Kyle
Views
Replies
Sign in to like this content
Total Likes
Make sure your Regular expression string doesn't have any spaces in it.
Also, for your if statement, you can change your condition to if (result==false) that way you don't need an empty execution block {}.
Kyle
Views
Replies
Sign in to like this content
Total Likes
Spaces in RegExp were the culprit. Thank you.
Views
Replies
Sign in to like this content
Total Likes