# Initialize Toggle Switch in Data Design

{% hint style="info" %}
**Block Information**

Available in: Page Flow

Toolbox Category: Dynamic Input

Block Type: [Regular](https://docs.zingy.ai/app-editor/block-anatomy#regular-block)
{% endhint %}

**`Initialize Toggle Switch in Data Design`** is a [regular block](https://docs.zingy.ai/app-editor/block-anatomy#regular-block) that is used to initialize [Checkbox](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/checkbox) and [Toggle Switch](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/toggle-switch) elements that were generated using the [Content from Data Design](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/content-from-data-design) block and dynamically added to the page or form.

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FAfftBhrLGPjdPeOdS5gZ%2Fimage.png?alt=media&#x26;token=2e4f7316-a18d-4e81-aeb9-35fe7f431a2c" alt="" width="343"><figcaption><p>Initialize Toggle Switch in Data Design block</p></figcaption></figure></div>

The block consists of the following (from top to bottom):

* *Data Design*: [Selectable Input](https://docs.zingy.ai/app-editor/block-anatomy#selectable-input) to choose the [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element whose element you want to target.
* *Element*: [Selectable Input](https://docs.zingy.ai/app-editor/block-anatomy#selectable-input) to choose  [Checkbox](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/checkbox) / [Toggle Switch](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/toggle-switch) elements, within the selected [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design), you want to initialize.
* *ID*: Optional [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts a [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) value representing the unique value that was provided to the [Content from Data Design](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/content-from-data-design) block. See below for more details.
* *ID2*: Optional [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts a [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types) value representing the secondary identifier that can be used to identify the desired element. See below for more details.

{% hint style="success" %}
NOTE: For the most common use cases, the ID and ID2 values need to be blank when using the **`Initialize Toggle Switch in Data Design`** block.
{% endhint %}

***

## ID and ID2 usage

The behavior of this block depends on the ID and ID2 [value parameters](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) and is detailed below:

* ID and ID2 not provided: Operate on the selected element for all generated instances of the same [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element.
* ID2 provided and ID not provided: Operate on the selected element for all generated instances of the same [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element with the same ID2 value.
* ID provided and ID2 not provided: Operate on the selected element for all generated instances of the same [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element with the same ID value. Since we recommend the ID value to be unique, this would choose one from all the generated instances of the associated [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element.
* ID and ID2 provided: Operate on the selected element for all generated instances of the same [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element with the same ID  and ID2 value.

***

## Usage Example

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2Fyj7dvfMkciSiPgGQcpGp%2Fimage.png?alt=media&#x26;token=abe9d92f-49ea-4ead-9116-3d4f954c48c6" alt="" width="503"><figcaption><p>Initialize Toggle Switch in Data Design example</p></figcaption></figure></div>

{% hint style="success" %}
NOTE: The same example also applies for a [Checkbox](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/checkbox) element.
{% endhint %}
