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

How do I make multiple buttons in the same group show a hidden field?

New Here ,
Feb 08, 2019 Feb 08, 2019

Copy link to clipboard

Copied

I am trying to create a survey with multiple groups of radio buttons. Currently, I have 9 different groups that each have 6 buttons (representing level of satisfaction from N/A to Very Satisfied). Essentially what I am trying to do is make it so that if you select either one of two of the buttons in the group, it will display a hidden field below the group of radio buttons. My problem is that in the group, lets refer to the buttons as button 1-6, if you select button 2, the script i have in the Mouse Up action works properly; it will display the hidden field when selected and hides it when it is unchecked or any other box is selected. However, I copied and pasted the same script in to button 6 with the Mouse Up action, and the field will not display or hide. Below is the JavaScript I am using. Any help/ideas/suggestions?

var showHide = event.target.isBoxChecked(0)?display.visible:display.hidden;

this.getField("1 Please detail any very satisfied/dissatisfied answers below").display = showHide;

TOPICS
Acrobat SDK and JavaScript , Windows

Views

360

Translate

Translate

Report

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

Community Expert , Feb 08, 2019 Feb 08, 2019

you've specified the (0) widget id in the "isBoxChecked" function. So it will always return the results for the first widget in the group. I'd suggest using the field value.

var showHide = (event.target.value != "Off")?display.visible:display.hidden;

Also, radio buttons will only turn on when clicked, so you are you really using radio buttons?

Votes

Translate

Translate
Community Expert ,
Feb 08, 2019 Feb 08, 2019

Copy link to clipboard

Copied

you've specified the (0) widget id in the "isBoxChecked" function. So it will always return the results for the first widget in the group. I'd suggest using the field value.

var showHide = (event.target.value != "Off")?display.visible:display.hidden;

Also, radio buttons will only turn on when clicked, so you are you really using radio buttons?

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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 ,
Feb 08, 2019 Feb 08, 2019

Copy link to clipboard

Copied

LATEST

The change you suggested worked perfectly. Thank you very much. I should have also added that I am by no means a coder or anything close, I just looked around some google searches and forums and found what I was using. I am completely out of my element when it comes to writing anything like this. I appreciate your time and thanks again for helping out!

Votes

Translate

Translate

Report

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