Skip to main content
Participant
February 8, 2019
Answered

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

  • February 8, 2019
  • 1 reply
  • 622 views

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;

This topic has been closed for replies.
Correct answer Thom Parker

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?

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
February 8, 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?

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
February 8, 2019

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!