Change Status of Checkbox
January 22, 2015 12:00 AM
Is it possible to change the status of a checkbox without clicking it (specifically, within a form)? I need to be able to change the state of a checkbox based on other selections, as per the example below:
The user can select 1 of 3 values from Column I - Option 1, Option 2, Option 3. Based on that selction, they will be able to select multiple values from a list of options (A-G) in Column II - if Opion 1 is selected, A-C become available; if Option 2 is selected, D-F becomes available; and if Option C is selected, G becomes available.
The problem I'm running into is, if I make Option 1 available, the user can select A-C. If they then choose Option 2, they can select D-F, although A-C will remain checked.
I can limit the user from only selecting one value in the first choice, Column I, II, or III by utilizing show/hide options, but can't seem to figure out a workaround for the secondary column.
I can provide images of the example if necessary.
Discussion (6)
Use action "Change contents" on a checkbox to modify it. Set it to "on" to toggle on, set to empty string to toggle off.
So in your case:
1. Create radio button group with 3 radio buttons. Add 9 checkboxes, group them in 3 groups of 3.
2. Add the following action to the radio group (not to buttons!) - "On select/change" - run group "Clear all"
3. Action group "Clear all" should contain 9 actions like:
- change contents - checkbox_1 - set to ""
- change contents - checkbox_2 - set to ""
- change contents - checkbox_3 - set to ""
...
- change contents - checkbox_9 - set to ""
4. It also should contain 3 actions like:
- hide Checkbox_Group_1
- hide Checkbox_Group_2
- hide Checkbox_Group_3
5. Radio button 1 should contain:
- action "On select/change" - show Checkboxes_Group_1
Same for the other two.
So what's going to happen as soon as ANY radio button is selected, every time:
- first all checkboxes are reset to unchecked and hidden
- then the required checkbox group is displayed
Check it out: https://dl.dropboxusercontent.com/u/11433463/trivantis/checkboxes/index.html
Thanks, ssneg - I'll give it a try.
What is the logic behind putting the action on the radio group instead of the button? Just to cut down on actions? A bit more in-depth on this project, multiple Columns should be able to be selected; therefore, I can't use a radio button group. [I suppose I could parse out the different Columns into specifics (e.g. Column I, Column II, Column III, Column I undefined but then if they select Column II, all Options would clear out until the user makes a new selection. Additionally, I would like all the Options to be visible, but only certain Options able to be selected when the Column(s) are selected.
When you add an action triggered by Change/Select to radio group, it triggers when any radio button in the group is selected. When you add it to a radio button, it triggers when that particular button is selected.
Instead of showing and hiding entire groups of checkboxes, you can show and hide semi-transparent overlays that "disable" them.
I attached the source file, feel free to play with it.
[ATTACH]631[/ATTACH]
Thank you both for your help on this. After looking at both of your titles, I've realized what the issue is: I was using custom form elements (Gel). Apparantly the 'Change Contents/Set Text/Checkbox#' will only work on the default form elements (for checkboxes at least).
I applied all the same actions to my title as were on each of yours, and they boxes wouldn't uncheck. I updated the preferences to not use custom form objects, and then everythign fell into place. I'll have to submit a case to Trivantis for this one.
Thanks again!
see if the attached does what you need. similar to sneg's but using checkboxes. choices are cleared if any changes made to column selection.
edit: group 5 in the example is not required. forgot to delete it.
When using customized checkboxes / radio buttons the problem is that these aren't checkboxes. They are just images that hide / show each other on click. The real checkboxes are also on the page but invisible. The real checkboxes are checked / unchecked by click on the images.
That means all your actions that target the checkboxes do work but it's not visible because the real checkboxes aren't visible.
Tim
Discussions have been disabled for this post