[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

Acrobat JavaScript to check for matching email addresses

Experts,

I have a PDF form with two fields so users can enter their email address twice before submitting the form.  I need an Acrobat JavaScript that can verify if the two text fields match.  If they match, it should submit the data, if they do not match, a message should be shown to let the user know that the email address entered do not match.  

The two fields are named ConfEmail & ConfEmail2.  This is what I have so far, but when I press the button nothing happens:

if(this.getField("ConfEmail")==this.getField("ConfEmail2"))
FRsubmit(); \\ This is a fuction that highlights any missing required field.  
else
console.println( "The e-mail addresses entered do not match" );

I really need this ASAP.  Thanks.
0
cartereverett
Asked:
cartereverett
  • 5
  • 3
1 Solution
 
ZvonkoSystems architectCommented:
Check:

if(this.getField("ConfEmail").value==this.getField("ConfEmail2").value)


0
 
ZvonkoSystems architectCommented:
Be also aware that both values are equal when both are empty.

0
 
ZvonkoSystems architectCommented:
Check this:

if(getField("ConfEmail").value>"" && getField("ConfEmail").value==getField("ConfEmail2").value){
  FRsubmit();  
} else {
  console.println( "The e-mail addresses entered do not match" );
}




0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
cartereverettAuthor Commented:
I'm not sure if I'm doing something wrong.  

I double clicked my submit button and went to the actions tab.  There I chose to add an action (Run a JavaScript) with Mouse Up as the Trigger.  Then on the JavaScript Editor I added:

if(getField("ConfEmail").value>"" && getField("ConfEmail").value==getField("ConfEmail2").value){
  FRsubmit();  
} else {
  console.println( "The e-mail addresses entered do not match" );
}

And nothing happens when I click the submit button.  I'm using Acrobat 7 Pro.
0
 
cartereverettAuthor Commented:
I was missing some information.  Currently, if I enter an email address correctly on both text fields, it works fine, but if the addresses do not match, I don't get any message.  So, for some reason the   console.println( "The e-mail addresses entered do not match" ); is not working.
0
 
ZvonkoSystems architectCommented:
Rather then console output use alert() method.
Like this:

if(getField("ConfEmail").value>"" && getField("ConfEmail").value==getField("ConfEmail2").value){
  FRsubmit();  
} else {
  app.alert( "The e-mail addresses entered do not match" );
}


0
 
ZvonkoSystems architectCommented:
0
 
cartereverettAuthor Commented:
Awesome.  You get 500 points well deserved. Thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now