Skip to main content
Known Participant
Feb 28, 2017 8:39 PM UTC
Answered

Select RadioButton based on dropdown values

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 is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Feb 28, 2017 8:52 PM UTC

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".

3 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Feb 28, 2017 8:52 PM UTC

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".

Translate
HeliosozAuthor
Known Participant
Feb 28, 2017 9:15 PM UTC

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.

Translate
try67
Community Expert
Community Expert
Feb 28, 2017 9:20 PM UTC

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).

Translate