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

Linking Checkboxes

New Here ,
Aug 12, 2019 Aug 12, 2019

I have a number of checkboxes arranged vertically, each on a separate line. They are separate from each other so the user may check one or several. However, I want the final checkbox to be "All of the Above" such that if that box is checked, it automatically unchecks the boxes above it that are linked to it. Is it possible to link that single checkbox to several others in the form? I know how to link 2 checkboxes so if one is checked the other is blank and checking it will uncheck the first box but I need help linking one box to several other boxes in that same manner.

TOPICS
PDF forms
3.9K
Translate
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 12, 2019 Aug 12, 2019

You can do it using a script, but do you want to only un-check the boxes? That would be a bit confusing, I think. You should either check or un-check all the other boxes based on the state of the last box, or you should use a button if you only want to un-check them.

Translate
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 12, 2019 Aug 12, 2019

Try67 - Thank you for your response. the user is allowed to select one or more of the boxes above the final box but if the final box is check, I do want it to un-check the boxes above it. I am a novice at using script, but it sounds like that is what I need to solve this issue, correct?

Translate
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 12, 2019 Aug 12, 2019

What should happen if the last box is un-checked, then?

Translate
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 12, 2019 Aug 12, 2019

It should restore any of the above-checked boxes that had been checked prior to checking the final box

Translate
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 12, 2019 Aug 12, 2019

That is more complicated. You would need to keep a variable in-memory that holds the state of all the check-boxes when that check-box was ticked, and then restore those values when it is un-ticked. I don't recommend you do that. The way most users will expect this button to work is that when you tick it all the other check-boxes are ticked, and when you un-tick it they are also un-ticked.

Translate
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 12, 2019 Aug 12, 2019

The user is filling out a form that will dictate the content of a final document based on their answers and they will intuitively know that if they check the final box, they want all of the above boxes checked but they have the option of checking some of the above boxes and leaving others unchecked but if they do check the final box, it should un-check the above boxes that were checked and if they then uncheck the final box, it should restore what the had previously checked in the boxed above the final box. Hope that makes sense. Doy you think it is too complicated?

Translate
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 12, 2019 Aug 12, 2019

I think it's unnecessarily complicated, and for no good reason, but it's certainly doable using a custom-made script.

Translate
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 12, 2019 Aug 12, 2019

Let me put it this way: Find me one instance of an "All of the above" check-box that works like you described. I bet you won't be able to, as that's not how they normally work.

Edit: some typos fixed

Translate
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 12, 2019 Aug 12, 2019

You have me with that one. I have never seen such a pdf form, however, this is an intake form telling me how to prepare a resulting legal document and those are all independent choices the user can include in or exclude from the resulting document. The manual form gives the same instruction and I am merely trying to automate it in a form they can complete on the computer and email back to me. The alternative is that if they check any of the above boxes and also check the final box, I get a mixed signal from them and must confirm what they want (not a horrible thing to have to do but being former programmer (way back) I love the challenge of making the computer do what I want it to do. Do you think it's worth the effort or should i

Translate
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 12, 2019 Aug 12, 2019

or should I leave well enough alone?

Translate
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 12, 2019 Aug 12, 2019

I think the intention is good, but you need to do it in a way that's consistent with what the users expect. If you add a "Check all of the above" button then you show have it, well, check all of the above (or un-check them) not try to go back to some previous arbitrary state. That's just going to cause more confusion.

The other option is that when the "All of the above" box is ticked, the other buttons become disabled, so the user can't change them while the "All of the above" box is ticked. They would need to un-tick it if they wanted to specify individual items.

Translate
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 12, 2019 Aug 12, 2019

This is the instruction to the user preceding all of these checkboxes:

"TO GRANT ALL THE POWERS LISTED BELOW, SELECT OPTION “N” AND IGNORE THE OTHER OPTIONS."

I can also add the instruction following box M: "If you have checked any boxes A thru M and change your mind and wish to check the box on line N, please uncheck the boxes between A and M you have already checked."  My intention is to do that for them. But again, it may just be too complicated

Translate
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 12, 2019 Aug 12, 2019

I would find that very confusing, personally...

Translate
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 12, 2019 Aug 12, 2019

I think the best way to do it is to use the last box to tick/un-tick all the other fields at once.

I wrote for you the code that does it. I suggest you test it out:

var otherFields = ["A", "B", "C"];

for (var i in otherFields) this.getField(otherFields).value = event.target.value;

Replace the values in the first line with your actual field name and put this code as the Mouse Up action of your last field.

Translate
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 12, 2019 Aug 12, 2019
LATEST

Well, I guess I'll drop this and leave the form as is. I sincerely appreciate you time and input. Thank You!

Translate
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