Skip to main content
Participant
Nov 2, 2026 8:04 PM UTC
Question

dropdown selection auto-selecting checkboxes

I hope someone can help as I’ve tried to follow other comments regarding checkboxes automatically being checked when selecting a dropdown choice and am getting no where.

I have a dropdown box with 4 lab group choices (HDRL, RAD, LDL, (blank = space bar).  

The blank choice is just there to force users to select lab otherwise the lab group stays blank. 

I then have checkboxes for all the labs that are associated with each lab group.  The checkboxes fields are named “cb1” for lab 1, “cb2” for lab2, “cb3” for lab3

How do I get:

  • Checkboxes cb1 - cb3 to only be checked when selecting HDRL in the drop down
  • Checkboxes cb4 - cb6 to only be checked when selecting RAD in the drop down
  • Checkboxes cb7 - cb9 to only be checked when selecting LDL in the drop down
  • When the lab choice is blank I’d like no boxes to be automatically check.

TIA

    1 reply

    Anand Sri Bhattacharya
    Community Manager
    Community Manager
    Nov 2, 2026 8:24 PM UTC

    Hello @Malcolm28876973cmri


    I hope you are doing well, and thanks for reaching out. Sorry for the trouble.


    You can try this with a small JavaScript attached to the dropdown field. I’d first clear all nine checkboxes and then check only the group associated with the selected dropdown value.

    Assuming your dropdown export values are exactly HDRL, RAD, LDL, and blank, you can use:


    var groups = {

        "HDRL": ["cb1", "cb2", "cb3"],

        "RAD":  ["cb4", "cb5", "cb6"],

        "LDL":  ["cb7", "cb8", "cb9"]

    };

    var allBoxes = ["cb1","cb2","cb3","cb4","cb5","cb6","cb7","cb8","cb9"];

    // Clear all checkboxes first

    for (var i = 0; i < allBoxes.length; i++) {

        this.getField(allBoxes[i]).value = "Off";

    }

    // Check only the boxes associated with the selected lab group

    var selected = event.value;

    if (groups[selected]) {

        for (var j = 0; j < groups[selected].length; j++) {

            var f = this.getField(groups[selected][j]);

            f.checkThisBox(0, true);

        }

    }


    Or,


    var groups = {

    HDRL: 1,

    RAD: 4,

    LDL: 7

    };

    var first = groups[event.value];

    for (var i = 1; i <= 9; i++) {

    var shouldCheck =

    first !== undefined && i >= first && i < first + 3;

    this.getField("cb" + i).checkThisBox(0, shouldCheck);

    }



    Add the script to the dropdown's appropriate selection action. Because the script clears the boxes first, selecting the blank entry will leave all nine unchecked. Also make sure the dropdown's export values match HDRL, RAD, and LDL exactly, and that the checkbox field names are exactly cb1 through cb9.

    Note: This is a sample script and may or may not work in your environment, as you might have to make changes depending on the PDF form type, app version, etc.


    To learn more about the JavaScripts in Acrobat and PDF forms, please refer to this article: https://adobe.ly/4A9uCnb


    Hope this helps, and please reach out if you need any assistance.

    Regards,

    Anand Sri.

    Translate