Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Text Wild Card

Avatar

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile
DKinsley
Level 3

02-09-2015

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");

}

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,682 posts

Correct Reply

489 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,682 posts

Correct Reply

489 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

03-09-2015

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 …");


}


Answers (3)

Answers (3)

Avatar

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile
DKinsley
Level 3

03-09-2015

Thank you so much! I appreciate your help.

Avatar

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile

Avatar
Validate 100
Level 3
DKinsley
Level 3

Likes

9 likes

Total Posts

545 posts

Correct Reply

5 solutions
Top badges earned
Validate 100
Validate 50
Validate 25
Validate 10
Validate 1
View profile
DKinsley
Level 3

03-09-2015

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 …");

  }

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,682 posts

Correct Reply

489 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

394 likes

Total Posts

2,682 posts

Correct Reply

489 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

02-09-2015

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.