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

88

Likes

translate

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

Adobe Community Professional , 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?

Likes

translate

Translate

Translate
Adobe Community Professional ,
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

Likes

translate

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

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!

Likes

translate

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