Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

In Confiforms, how do I turn off a specific checkbox in a checkbox group?

fbunting
Contributor
June 12, 2019

In Confiforms, I have a checkbox group mycbgroup with checkboxes cb1, cb2, cb3, cb4, cb5.

I am trying to make some of them work as a sub-group ... so (e.g.) if user checks/unchecks cb1, then this checks/unchecks cb3, and vice-versa.

I almost have this working using Field Definition Rules, as I know how to create a rule that turns specific checkboxes on ... by using a Set Value action as follows:

mycbgroup=[entry.mycbgroup.asList],cb1,cb3

My question, how do I write a rule that turns specific checkboxes off?

2 answers

0 votes
fbunting
Contributor
June 12, 2019

Ah, I think I found it!

mycbgroup=[entry.mycbgroup.asList.replaceWith(cb1,).replaceWith(cb3,)]
fbunting
Contributor
June 12, 2019

The reason this works, is that in the Set Value action, the right side of the assignment needs to be a string -- a comma-separated list of the checkboxes that should be turned on. Any checkboxes not listed are turned off.

The asList virtual function renders the field value as a comma-separated string, so that we can manipulate it.

To append more comma-separated checkbox IDs to the string, you just add them outside the square brackets following the asList.

mycbgroup=[entry.mycbgroup.asList],cb1,cb3

To remove checkbox IDs from the string, you use the replaceWith virtual function.

mycbgroup=[entry.mycbgroup.asList.replaceWith(cb1,).replaceWith(cb3,)]

 

0 votes
Alex Medved _ConfiForms_
Community Champion
June 12, 2019

You shall use ConfiForms Definition Rules with action reset value

fbunting
Contributor
June 12, 2019

Yes, but what is the syntax for the set-value?

The above was my set-value syntax for turning *on* specific checkboxes, but what do you use to turn specific boxes *off*?

Alex Medved _ConfiForms_
Community Champion
June 12, 2019

Reset value action to reset all in the field and then Set value to select specific

fbunting
Contributor
June 12, 2019

I'm still not clear.

As I understand it, the Reset Value action will undo the change to the checkbox group.   I.e., if the user turns cb1 off, then the action will reset it back to on.  I don't want that.

What I want is: if the user turns cb1 off, then I want the rule to automatically turn cb3 off as well, while leaving the remaining checkboxes unaffected.

I know how to turn it on, using the Set Value action (set as I describe above).   But I don't know what Set Value action to specify to turn cb3 (and only cb3) off.

fbunting
Contributor
June 12, 2019

Or to put it another way, if the user turns cb1 off, and I use the Reset Value action (which turns it back to on), then I still need to know what Set Value action syntax to use to change both cb1 and cb3 to off ... while leaving the remaining checkboxes unaffected.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events