Skip to main content
Known Participant
February 28, 2017
Answered

Select RadioButton based on dropdown values

  • February 28, 2017
  • 1 reply
  • 1802 views

Hey Everyone,

I'm trying to populate a radiobutton selection based on the values of two drop down values in Adobe Acrobat X. Here's my javascript, but it doesn't populate the radiobutton/check it. I've put the javascript as a validate event in the second dropdown, although it doesn't work under calculate either.

if(this.getField("ddlOne").value == "Admin" && event.value == "User")

{

this.getField("Checkbox").value = "On";

}

Any ideas ?

This topic has been closed for replies.
Correct answer try67

First of all, the comparison operator in JS is "==", not "=". So you need to change both of them in your if-statement.

Also, you need to make sure what is actually the "on" value of your check-box. By default it is "Yes".

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 28, 2017

First of all, the comparison operator in JS is "==", not "=". So you need to change both of them in your if-statement.

Also, you need to make sure what is actually the "on" value of your check-box. By default it is "Yes".

HeliosozAuthor
Known Participant
February 28, 2017

Thnx try67,

I actually had it as "==" because the acrobat js editor won't allow "=" but I accidentally put "=" in my post. Although I think the issue was ON needed to be Yes as you pointed out.

Would it be possible to initiate this on dropdown selection ? Currently it seems like I have to click out of the drop down in order to get the radio button selected.

try67
Community Expert
Community Expert
February 28, 2017

Yes, it's possible. Place the code as the drop-down's custom validation script and make sure to tick the option to commit the selected value immediately (under the field's Properties - Options tab).