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

Evaluating Multiple Sets of Radio Buttons With JavaScript

New Here ,
Nov 27, 2020 Nov 27, 2020

I have a form with 3 yes/no questions. I am using radio buttons (a, b, c).  I need to trigger an event -- make a hidden text box visible -- only if the answer is 'yes' to all three questions.

I have this code but it doesn't work. Not sure what's wrong. Please help

event.target.hidden = !( (this.getField("a").value=="aYes") && (this.getField("b").value=="bYes") && (this.getField("c").value=="cYes"))

TOPICS
Acrobat SDK and JavaScript
797
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 ,
Nov 27, 2020 Nov 27, 2020

Where did you place this code? Are there any error messages in the JS Console when you use it?

You should not use the hidden property. It's deprecated. Use the display property, instead.

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
New Here ,
Nov 27, 2020 Nov 27, 2020

I placed it in the custom calculation script of the hidden field

No didn't get any errors

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 ,
Nov 27, 2020 Nov 27, 2020

Can you share the actual file with us?

You can attach it to the original message using the tiny paperclip icon at the bottom when you edit it, or upload it to a file-sharing website (like Dropbox, Google Drive, Adobe Cloud, etc.), generate a share link and then post it here.

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
New Here ,
Nov 27, 2020 Nov 27, 2020

No luck with display either

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
New Here ,
Nov 27, 2020 Nov 27, 2020

sample file 

here it is

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 ,
Nov 27, 2020 Nov 27, 2020

You didn't use the correct export values in your code. It's "Yes" and "No", not "aYes", "bYes", etc.

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
New Here ,
Nov 27, 2020 Nov 27, 2020
LATEST

Thank you so much!

🙂

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