JavaScript to check checkbox(es) on different drop down selection


Badge +9

I have a drop down field with values A, B, C, D, and E and various check boxes which are yes/no question grouped based on drop down values like 5 questions for A, 3 questions for B, etc.. The drop down values are in order, meaning D comes after C, C comes after B and so on. How do i automatically check the all check boxes when lets say C is selected, i would like to automatically check the A and B check boxes. If B is selected, i would like to automatically check the A check box only. If E is selected I would like to automatically check all A B C and D check boxes.


9 replies

Userlevel 5
Badge +14

What happens to the groups of questions (checkboxes) that are beyond the group selected from the drop down? 

Are they disabled, or are they freely selectable? 


Badge +9

I have disabled them using a rule. Those are only enabled in steps, meaning A first then B then C and so on after all the questions are checked from each group. Each group gets enabled after checking of all the questions from prior group.

Userlevel 5
Badge +14

Perhaps I'm getting confused, but it seems like there are lots of ways you'd like to enable people to interact with your checkbox groups. 

For clarity please verify the following or in explicit terms, describe how you'd like this to work. Pictures would also help. 

 

  • No Selection Made from the DROP DOWN control
    • No Question Groups can be accessed (all checkboxes are unchecked and disabled)

  • Selection Made from the DROP DOWN control 
    • Any and all previous Question Groups have the checkboxes contained therein set to Checked and Disabled. 
    • The TARGET Question Group (associated to the selection of the Drop Down Choice Control) is ENABLED but all checkboxes are left UNCHECKED (so the user can check whatever they'd like)

    • Question: If all boxes in the enabled Group are checked, should the NEXT value in the drop down be selected????

 

Badge +9

Please find attached video.

By default only A group questions are left unchecked.

Sometimes project manager decides to jump to different group assuming all prior groups as completed or without having to check the question boxes in each prior groups individually.

Therefore having to check boxes automatically when moving from one to another would be great solution.

Note: we cannot move backwards.

Badge +9

anyone able to help me with this?

Badge +4

Please find the attached form and preview the form and test it. Let me know if this what you are looking for.

Badge +9

@rameshmusham 

This is awesome! Exactly what i was looking for. Thank you for your help!!

One last request, is there a way to uncheck check boxes when values are changed in the drop down. It may come up once i present this to my peers.

Badge +4

The functionality is already inbuild in the current form, you can test it. when you select C the A,B checkboxes will be checked by default and when you change the dropdown to A the values of B checkboxes are changed to unchecked. 

 

You can test it by adding calculated columns for each checkbox and see the result.

Badge +9
Thank you Rameshmusham,
I tested it and it works!
What if there is one more item in drop down called "All Complete", which would check all the checkboxes, and rest would work in previous manner.

Reply