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.
cartereverettAsked:
Who is Participating?
 
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:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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
 
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:
0
 
cartereverettAuthor Commented:
Awesome.  You get 500 points well deserved. Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.