Hello,
I am looking for a way to have a specific toggle field, if Checked, trigger other toggle fields that i already have in my snippet to be automatically checked to Yes.
So, at the top of my form I have 3 toggle fields: Complete, Partial.
In the body of my snippet, i have the following toggle fields:
Weight:
Size:
Eyes:
Ears:
Neck:
If I check 'Complete' at the top, i want all my toggle fields in the body to automatically get checked as well. If i check 'Partial', I want only Weight and Size to get checked on automatically.
How can I do this?
hey @dalida.el-samra.cnmt
Welcome to the community. There are 2 ways you can do this:
First option: will automatically check the boxes as you wanted, but if you check one box and then uncheck it, the boxes below will remain checked.
{formtoggle: name=complete}{weight=yes}{size=yes}{eyes=yes}{ears=yes}{neck=yes}{endformtoggle}
{formtoggle: name=partial}{weight=yes}{size=yes}{endformtoggle}
{formtoggle: name=weight; default=no}
{formtoggle: name=size; default=no}
{formtoggle: name=eyes; default=no}
{formtoggle: name=neck; default=no}
Second option: slightly more complicated, but it will uncheck the lower boxes when the upper boxes are unchecked. It will also return an error if both complete and partial are checked.
{formtoggle: name=complete}
{formtoggle: name=partial}
{if: complete and not partial}{weight=yes}{size=yes}{eyes=yes}{ears=yes}{neck=yes}{elseif: not complete AND not partial}{weight=no}{size=no}{eyes=no}{ears=no}{neck=no}{elseif: partial and not complete}{weight=yes}{size=yes}{eyes=no}{ears=no}{neck=no}{elseif: partial AND complete}{error: Select only one option; block=yes}{endif}
{formtoggle: name=weight; default=no}
{formtoggle: name=size; default=no}
{formtoggle: name=eyes; default=no}
{formtoggle: name=neck; default=no}
In both cases, you can't check or uncheck the lower boxes if either the Complete or Partial boxes are checked.
3 Likes
Thank you that worked!
To explore this further, I am trying to pre-set a value to get toggled ON inside of a list. I was able to do it with a dropdown menu (e.g. if i check complete, then value x from dropdown menu y is pre-populated). but i am unable to set a value from a specific list to get checked ON if i check complete, for example. I tried with both the formmenu name and the list name.
Can you post an example of what you mean specifically?
You can add a snippet's contents to a community post here:
