Set Toggle Switch State
Last updated
Last updated
Set Toggle Switch State
is a regular block that allows you to set the state of Checkbox and Toggle Switch elements on a page or form.
Refer to the Set Toggle Switch State in Data Design block for dynamically generated content.
The block comes in two modes which are discussed below.
The Mode 1 version of the Set Toggle Switch State block consists of (from left to right):
Element: Selectable Input to choose the element you want to set the state of.
Data: Value Parameter that accepts a boolean (true/false) type value to set.
The Mode 2 version of the Set Toggle Switch State block consists of (from left to right):
Element: Value Parameter that accepts either a text value in the form of a CSS Selector or an element value. The Element block comes pre-attached for your convenience but can be removed and customized.
Data: Value Parameter that accepts a boolean (true/false) type value to set.
NOTE: The same examples also apply for a Checkbox element.
The image below shows an example of the Mode 1 version where the Data value parameter is attached to a Variable Value block configured to use the variable b which has been set to "true". This would toggle the switch to the "ON" position.
In the next example we see a Mode 2 version where the Element value parameter is attached to a Text block containing a CSS Selector that selects the same element. This time the Data value parameter is attached to the True/False block containing the value "false". This would toggle the switch to the "OFF" position.
NOTE: Using a CSS selector, you can operate on multiple elements that match the criteria specified by the selector. See the references below for more information: