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

How do I display a message when 2 fields are the same?

Guest
Aug 06, 2019 Aug 06, 2019

Hello,

I am working on a new form that requires the input of bank account information.  I would like to have 2 fields for the routing and 2 fields for the account number.  I want to be able to display a message if the 2nd input does not match the 1st.  Just trying to add an additional layer of verification.

Optimally Id like to stack the fields and show the verification field on top of the initial field to avoid the old copy and paste, but I am sure there are a few more mechanics invloved in that implementation.

Can someone help me with this request?  Thanks!

JT

TOPICS
Acrobat SDK and JavaScript , Windows
770
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

correct answers 1 Correct answer

Deleted User
Aug 07, 2019 Aug 07, 2019

I generally dont like pop-ups but this solution checks off all of my requirements.  The code works as intended.

Thank you for your assistance.

Translate
Community Expert ,
Aug 06, 2019 Aug 06, 2019

What kind of message? Text on the page? A pop-up alert window?

Also, should it only appear when the second field is edited? What about if the first one is edited after the second has a value, and they no longer 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
Community Expert ,
Aug 06, 2019 Aug 06, 2019

My recommendation is to use a single read-only field for each input then use a response object to collect the routing and account numbers and only populate the field value when the values coming back from the response match. It would look something like this...

var routing1 = app.response("Enter the routing number");

var routing2 = app.response("Enter the routing number again");

if (routing1 == routing2) {

     this.getField("routingNumber").value = routing1;

}

else {

     app.alert("Routing numbers don't match");

}

You'll need to put the code into a button or link near the field since it is read-only and won't get mouse clicks.

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
Guest
Aug 07, 2019 Aug 07, 2019

I generally dont like pop-ups but this solution checks off all of my requirements.  The code works as intended.

Thank you for your assistance.

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 ,
Aug 07, 2019 Aug 07, 2019
LATEST

You don't have to use a pop-up. You can set the error message as the second field's value, for example, or even a third field, just used for that warning message.

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