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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Script Object Function Email Verification

Avatar

Level 5

This form uses a script object to hold a function that runs the email verification code. I haven't yet figured out why the the value of EMAILADDRESS is undefined. I want the textfield1 to equal empty (not the word, but a blank space) if the email address doesn't match "@testdomain.com". Any ideas? Thanks.

https://workspaces.acrobat.com/?d=wZR1nYuqo*IRbQEypEsbow

Greg

2 Replies

Avatar

Level 10

Hi Greg,

You have a name conflict in your code.  On line 3 of SOemailverification you define a variable EMAILADDRESS but I your code, I think, wants to access the form variable EMAILADDRESS (defined in the form properties).

I think you just need to delete line 3 of SOemailverification.

Also with a RegExp you can specifiy they are case insensitive, so you could use RegExp("^[A-Z0-9_\\-\\.]+\\@testdomain.com", "i"), that is with the "i" option in argument two, so you may not need the four RegExp?

Regards

Bruce

Avatar

Level 5

Bruce,

I tried your ideas, but didn't get them to work. I finally realized I wasn't being specific enough for what the textfield1 should equal. I also changed the function variable name since it was the same as the global variable "EMAILADDRESS". Thank you for your help. The document works correctly now.

Greg

https://workspaces.acrobat.com/?d=O6IRlhfajI8VtMkb*ROtxQ