Skip to main content
January 12, 2017
Answered

Dependent check boxes, how to check all previous boxes, but not the latter ones.

  • January 12, 2017
  • 1 reply
  • 7354 views

Hello,

I have an order form with quantities 1-60, each with a corresponding check box.  The reason is that sometimes when a client orders our product they want ten, sometimes they want 60 sometimes more.

I would like to know how to make it so that if our client wants 47, instead of checking each of the 47 boxes i pick just the 47th box and all previous boxes are checked as well.

I don't see a way to attach my file in here, but I do not mind sending it so people can see what I am trying to accomplish.

Thank you in advance for any help.

P.S. my java and coding knowledge is nil. I am an architectural draftsperson who was, for some strange reason, tasked with making all these pdf order forms. So I am really new to this pdf form making process.

I only have access to Adobe X standard (or Pro if I kick my coworker out of her computer, for some reason she has it but not me.)

This topic has been closed for replies.
Correct answer try67

OK, let's say the fields are called "Checkbox1" to "Checkbox60". You can use a doc-level function (although you'll need Acrobat Pro to add it) with this code and then call it from the MouseUp event of each of those fields:

function tickPreviousBoxes() {

    if (event.target.value!="Off") {

        var boxNumber = Number(event.target.name.replace("Checkbox", ""));

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

            this.getField("Checkbox"+i).checkThisBox(0, true);

        }

    }

}

1 reply

try67
Community Expert
Community Expert
January 12, 2017

Why not simply create a drop-down or a text field where they can specify how many items they want, instead of doing it with so many check-boxes?

January 12, 2017

We need our factory workers to sign and date beside each piece when it was created so that we can keep track of when and where each piece is and when it has left our factory and send to site (precast concrete products, each piece looks identical so they have different marks to differentiate). 

Below is an image of the count sheet I have created, it is then combined with each of our products which has its corresponding order form. This way i do not have to create count sheet for each individual job with the correct amount of pieces.  What I was thinking was, if there was 47 pieces, the person taking the order simply clicks 47, then all previous boxes fill with "x" or check marks or what have you and that way the factory workers don't get confused and think there are 60 pieces each time there is an order.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 12, 2017

OK, let's say the fields are called "Checkbox1" to "Checkbox60". You can use a doc-level function (although you'll need Acrobat Pro to add it) with this code and then call it from the MouseUp event of each of those fields:

function tickPreviousBoxes() {

    if (event.target.value!="Off") {

        var boxNumber = Number(event.target.name.replace("Checkbox", ""));

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

            this.getField("Checkbox"+i).checkThisBox(0, true);

        }

    }

}