Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Confirm Email validation script (PDF Javascript)

Explorer ,
Jun 17, 2020 Jun 17, 2020

Hello everyone, I am new to this forum and any and ALL help would be beyond appreciated on this:  I am creating a form where I need to have a box for a user to enter their "email" - lets call the box "email" and then I need them to re-enter the email to confirm that is what they wrote initially (lets call that "validate email").  This way human error can be avoided.  Finally a message would alert the user if the boxes DO NOT match.  This is what I am currently attempting but it is not working:

 

email==confirmEmail?"":msg;

 

I have also tried this:

 

if (! eMailValidate(event.value) && event.value != "") {
event.rc = false;
app.alert({
cMsg: "Invalid email address - Please try again",
cTitle: "Email1",
nIcon: 0,
nType: 1
});
}

 

BUT while this is nice, it doesnt confirm the email.  It would be nice to have both features in one.  Thank you all for your valuable time and assistance in advance.

TOPICS
Create PDFs , PDF forms
3.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 18, 2020 Jun 18, 2020

You can use this:

 

var email1 = this.getField("email").valueAsString;
var email2 = this.getField("confirmEmail").valueAsString;
if (email1!=email2) app.alert("The email addresses you entered do not match!");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 25, 2020 Jun 25, 2020
LATEST

Hi Try67, thank you so much for the quick reply! Im so sorry I didnt write back sooner, I received a notification today that a reply was posted but it shows you replied immediately after I posted it. I used your formula in the "validate" (run custom validation script).  I labeled the boxes ("email" for box 1 and "emailConfirm") I placed the validation script on "emailConfirm" and it DID NOT work.  I tinkered with it on purpose and wrote: "John" on box1 and then "Jay" on box2... I received an error message (which is what I want) but when I then did: "john@gmail.com" and then repeated the email on box2... it STILL gave me the error message.  So the popup alert works perfect but maybe I'm inputting the validation script in the wrong place? I thought this was correct. Thank you for your valuable time and help!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines