• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to make a dropdown selection select checkboxes

Community Beginner ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Hello,

 

Curious if it's possible to make a specific dropdown selection also populate specified checkboxes later on a .pdf form? Other options within the dropdown should not check any boxes. Is this possible? Thanks!

TOPICS
How to

Views

3.3K

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 2 Correct answers

Community Expert , Feb 01, 2023 Feb 01, 2023

In the dropdown field under 'Options' tab, check 'Commit selected value immediately' if you want the script to trigger without the need to click outside the field once you make the choice.

Use this as 'Validation script of dropdown field:

this.getField("Unbundled").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box28").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box29").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check
...

Votes

Translate

Translate
Community Expert , Aug 09, 2023 Aug 09, 2023

Use this:

this.getField("Staffing Needed").checkThisBox(0, event.value=="High*" || event.value=="Very High*");

Votes

Translate

Translate
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Yes it is if you know JavaScript, and the document object model. But it will only work when viewing the PDF in Acrobat, though.

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Where exactly do you need this to work? Do you have control over the application that will be used to fill the form?

Votes

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
Community Beginner ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

I attached the document I'm looking at, I need when "DB" is selected in 'Type of Plan' that all of the other highlighted check boxes become checked. Sorry I should have attached the doc for context; would it still be possible?

Votes

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
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

++ Adding to the discussion,

 

 

You can do that very easily with a script.

 

But what do you need to happen to the highlighted checkboxes when the user goes back and unchecks the DB checkbox?

 

Do you also need all of those checkboxes to become unchecked or leave them checked?

Votes

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
Community Beginner ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Oh, that's great news! I would like for when 'DB' is selected in type of plan that the following options become checked:

  • Unbundled
  • N/A - Unbundled
  • N/A
  • N/A
  • N/A - Unbundled DB
  • N/A - Unbundled DB

 

And of course if something else is selected from the dropdown, these all become unchecked.

Votes

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
Community Expert ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

Make a structure to see what the checkboxes are called: 
You would beed something like: 

var myBox = this.getField("R1");
var myBox2 = this.getField("R2");

if (myBox.value === "Yes") {
    myBox2.value = "Yes";       
}

if (myBox.value !== "Yes") {
    myBox2.value= "";       
}

 Where R1 is the box you woould check and R2 is the box that is contolled by checking box R1.
I like to define the veriables to make script more reusable.

Votes

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
Community Expert ,
Feb 01, 2023 Feb 01, 2023

Copy link to clipboard

Copied

In the dropdown field under 'Options' tab, check 'Commit selected value immediately' if you want the script to trigger without the need to click outside the field once you make the choice.

Use this as 'Validation script of dropdown field:

this.getField("Unbundled").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box28").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box29").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box30").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box26").checkThisBox(0,event.value == "DB" ? true : false);
this.getField("Check Box32").checkThisBox(0,event.value == "DB" ? true : false);

And here is your file with script added:

https://drive.google.com/file/d/1k_VO9gnLuMP3EdHsDPkvQD46eT9qN5DU/view?usp=share_link 

 

Votes

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
Community Beginner ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

Thank you so much!!

Votes

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
Community Expert ,
Feb 02, 2023 Feb 02, 2023

Copy link to clipboard

Copied

Thanks I see I didn't read the question correct

Votes

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 ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

I have a similar situation in that I would like only 2 out of 5 drop down options ("High" and "Very High") to trigger the same checkbox ("Staffing Needed"). I am using the following script: 

this.getField("Staffing Needed").checkThisBox(0, event.value=="High*")

this.getField("Staffing Needed").checkThisBox(0, event.value=="Very High*")

 

This works with one option ("Very High") but not both. I am unsure as to how to make it so that both options (High and Very High) will prompt the checkbox. Is there a way to write both options into the script? Thank you.

 

 

Votes

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
Community Beginner ,
Aug 09, 2023 Aug 09, 2023

Copy link to clipboard

Copied

I obviously am not an expert in this either but I'll try and pay it forward! Perhaps try separating the commands with a semicolon or if that doesn't work, try "or" instead of a semicolon.

 

Blind leading the blind here but maybe it'll work. 

Votes

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 ,
Aug 09, 2023 Aug 09, 2023

Copy link to clipboard

Copied

Thank you for the response and suggestions. I did try both and unfortunately neither worked. 

Votes

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
Community Expert ,
Aug 09, 2023 Aug 09, 2023

Copy link to clipboard

Copied

Use this:

this.getField("Staffing Needed").checkThisBox(0, event.value=="High*" || event.value=="Very High*");

Votes

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 ,
Aug 10, 2023 Aug 10, 2023

Copy link to clipboard

Copied

Thank you very much! It worked. 

Votes

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 ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

Hi, 

I want kind of same thing to happen. The dropdown name is "Dropdown2" and it has 2 values, yes and no. and there is a checkbox "checkbox2", i want this checkbox to be checked whatever option you choose from the dropdown. Can you please write the complete script, so i just copy and paste. thank you

Votes

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
Community Expert ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

This doesn't make much sense to me, if there are only 2 values in the dropdown and checkbox will be checked no matter what selection is made, why not just check the checkbox manually and leave it checked?

Votes

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 ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

It is a whole sheet with different tasks on it. I will do the rest, just wanted to had an idea. If i get it done by your help i will do the rest. It's a list of tasks, so task should be checked when you select an option from the dropdown. Hope you understand now. 

Votes

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
Community Expert ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

As validate script of dropdown you can use this:

if(event.value == "yes" || event.value == "no")
this.getField("checkbox2").checkThisBox(0,true);

Votes

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 ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

It didn't work.

Votes

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
Community Expert ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

Are your values "yes" and "no" or "Yes" and "No"?

Votes

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 ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

Yes and No

Votes

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 ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

it worked now. thank you

Votes

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 ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

one last question, if i have 3 values in dropdown, for example, "None". How would you do it? Thank you

Votes

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
Community Expert ,
Nov 30, 2023 Nov 30, 2023

Copy link to clipboard

Copied

If "None" is selected, you want to uncheck checkbox?

You can use this to uncheck if "None" is selected and check if "Yes" or "No" is selected:

this.getField("checkbox2").checkThisBox(0,(event.value == "Yes" || event.value == "No")? true : false);

Votes

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