Skip to main content
rakeshk21205956
Inspiring
November 17, 2017
Answered

Radio button based on Check box - PDF acrobat

  • November 17, 2017
  • 1 reply
  • 2703 views

I have  two sets of radio button  R1  and R2   and a check box......

I want  to function them as below:

If  R1 has two Option   Yes   or No     so if one selects  "yes"  here   and checks the Checkbox  then the same  "Yes"  should be automatically selected in the R2  similarly if in R1 set  "No" is selected then R2 should also be "No".

Else if check box is not selected.. both Radio buttons can be independently selected .

I tried it with the following script but it didnot worked:

if (this.getField("Checkbox").value == "Yes")

{this.getField("R2").value = this.getField("R1").value;}

Thanks in advance

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

You know, after going back and looking at the article, your right, it doesn't provide a direction for the solution. At least not directly.

Sorry, I missed the point of your explanation.

So your orginal code code should work, just as long as all the assumptions are correct, i.e. the radio export values are Yes and No for each button group, and the checkbox export is yes. And the code is on the MouseUp event on the checkbox.

I tried it and it all works, except with this variation, which shouldn't matter

if (event.target.value == "Yes")

{this.getField("R2").value = this.getField("R1").value;}

1 reply

Thom Parker
Community Expert
Community Expert
November 17, 2017

The thing about Radio Buttons is that a Group of buttons only has one value, so only one can be selected at a time.

What you want is a set of managed check boxes.  You can make two of them look like radio buttons by changing the appearance.

Here's an article on using Checkboxes as Radio Buttons, you want a variation of this scheme

https://acrobatusers.com/tutorials/creating-radio-checkboxes

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
rakeshk21205956
Inspiring
November 17, 2017

Thanks for the link it was quite informative  but it didnot solved my purpose.....................

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
November 17, 2017

You know, after going back and looking at the article, your right, it doesn't provide a direction for the solution. At least not directly.

Sorry, I missed the point of your explanation.

So your orginal code code should work, just as long as all the assumptions are correct, i.e. the radio export values are Yes and No for each button group, and the checkbox export is yes. And the code is on the MouseUp event on the checkbox.

I tried it and it all works, except with this variation, which shouldn't matter

if (event.target.value == "Yes")

{this.getField("R2").value = this.getField("R1").value;}

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