Skip to main content
ezloves2smile
Known Participant
October 6, 2020
Answered

Email Confirm / Validate Field

  • October 6, 2020
  • 3 replies
  • 2108 views

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.

 

I got the following as an answer:

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

 

However, I replied:

 

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!

    This topic has been closed for replies.
    Correct answer Nesa Nurani

    In that case you can use this code:

     

    if(event.value != this.getField("email").valueAsString){
    app.alert("The email addresses you entered do not match!");}
    else if(event.value == this.getField("email").valueAsString){
    app.alert("Email Confirmed!", 3);}

    3 replies

    JR Boulay
    Community Expert
    October 6, 2020

    "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. "

    I think on the contrary that it multiplies the risk of data entry error by two.
    Besides, it's a bit insulting, why not also ask him twice for his name or his phone number?

    😉

    Acrobate du PDF, InDesigner et Photoshopographe
    ezloves2smile
    Known Participant
    October 7, 2020

    Thank you JR, I appreciate your reply and I get what you're saying. Believe me, if most people were as smart as people who code, design and overall work in I.T. and related fields, I would just put it once BUT... we know that's not the case so it's just a precaution measure (AND you'd be incredibly surprised how many actually fail to do it right the first time.

    Nesa Nurani
    Community Expert
    October 6, 2020

    You can use this as custom validation script of "confirmEmail" field:

    if(event.value != this.getField("email").valueAsString){
    app.alert("The email addresses you entered do not match!");}

    this won't give you alert if fields are the same.

    Sry I didn't understand what you mean to also confirm email?

    You want some sort of alert if emails match?

    ezloves2smile
    Known Participant
    October 6, 2020

    Thank you for the prompt reply, I will try it now and yes... that's exactly what I was asking. 

    Nesa Nurani
    Nesa NuraniCorrect answer
    Community Expert
    October 6, 2020

    In that case you can use this code:

     

    if(event.value != this.getField("email").valueAsString){
    app.alert("The email addresses you entered do not match!");}
    else if(event.value == this.getField("email").valueAsString){
    app.alert("Email Confirmed!", 3);}

    Just Shoot Me
    Brainiac
    October 6, 2020

    I moved your post over from the poorly named "Using the Community" forum, which is for getting help using this forum system, to a better forum.


    I hope this helps. Best of luck to you.