I want to write a script to verify the user entered their company email address correctly. The only part of the email address I can verify is the last section (@companyname.com), Is there a text wild card that I can use that represents and amount of text so I can verify the last section of the address, like *:
If(emailaddress.rawValue !== *@companyname.com){
xfa.host.msgbox("Last part of your email address is not correct");
}
Solved! Go to Solution.
Views
Replies
Total Likes
Here you go
var str = Textfield1.rawValue;
if (!str.match(/^([a-zA-Z0-9\-\_\.]+)@(domain1|domain2).com$/gm)) {
xfa.host.messageBox("The E-Mail-Address in not correct …");
}
Views
Replies
Total Likes
Hi,
you can use a regular expression to test the email-addresses.
var str = Textfield1.rawValue;
if (!str.match(/^([a-zA-Z0-9\-\_\.]+)@yourdomain.com$/gm)) {
xfa.host.messageBox("The E-Mail-Address in not correct …");
} else {
// Script to execute otherwise …
}
Hope this helps.
Views
Replies
Total Likes
radzmar,
Your script works great but I have two company domains that I have to compair to what the user enters. In other words they have to enter either myname@domain1.com or myname@domain2.com. If it is neither of these then the error message pops-up. I tried to modify your script to accomdate this but cannot get it to work.
var str = this.rawValue;
if ((!str.match(/^([a-zA-Z0-9\-\_\.]+)@yourdomain.com$/gm))||(!str.match(/^([a-zA-Z0-9\-\_\.]+)@yf.com$/gm))) {
xfa.host.messageBox("The E-Mail-Address in not correct …");
}
Views
Replies
Total Likes
Here you go
var str = Textfield1.rawValue;
if (!str.match(/^([a-zA-Z0-9\-\_\.]+)@(domain1|domain2).com$/gm)) {
xfa.host.messageBox("The E-Mail-Address in not correct …");
}
Views
Replies
Total Likes
Thank you so much! I appreciate your help.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies