# Set Element Attribute in Data Design

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

Available in: Page Flow

Toolbox Category: Dynamic Content

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

**`Set Element Attribute in Data Design`** is a [regular block](https://docs.zingy.ai/app-editor/block-anatomy#regular-block) that allows you to set the value of any [HTML attribute](https://en.wikipedia.org/wiki/HTML_attribute) in 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%2Fl35kkyDhEqDFouOU2uAp%2Fimage.png?alt=media&#x26;token=c19a3006-1a4e-483b-aa6a-1add709cbd00" alt="" width="265"><figcaption><p>Set Element Attribute in Data Design block</p></figcaption></figure></div>

The behavior of the block is similar to the [Set Element Attribute](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/set-element-attribute) block, with some important differences:

* Works only with elements generated using [Content from Data Design](https://docs.zingy.ai/app-editor/page-flow/toolbox-blocks/content-from-data-design) block that are dynamically added.
* Element Selection: You can only choose an element placed inside the selected [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design) element.

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

* *Attribute*: [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 [HTML attribute](https://en.wikipedia.org/wiki/HTML_attribute) to set or change the value of.
* *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 the element, within the selected [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design), you want to set the attribute of.
* *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.
* *Data*: [Value Parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) that accepts the value for the attribute being set (of type [*text*](https://docs.zingy.ai/app-editor/page-flow/references/value-types)*)*

***

## 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.&#x20;

***

## Usage Examples

{% hint style="info" %}
**NOTE: Please refer to the prerequisite information shown** [**here**](https://docs.zingy.ai/app-editor/page-flow/references/prerequisite-for-dynamic-content-block-examples) **before seeing the example.**&#x20;
{% endhint %}

The image below shows an example in which the [Link](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/link) element (Company Link) is selected. For this element, the *Attribute* [value parameter](https://docs.zingy.ai/app-editor/block-anatomy#value-parameters) is set to [href](https://docs.zingy.ai/page-editor/built-in-elements/link#href) and the *Data* value parameter is linked to a [Text](https://docs.zingy.ai/app-editor/page-editor/editing-text) block that contains the Zingy website URL.

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2Fku88i8QUxyIGDhyeFx92%2Fimage.png?alt=media&#x26;token=66764a32-44c5-4f12-9a59-13c2a9dfea58" alt="" width="563"><figcaption><p>Set Element Attribute in Data Design example 1</p></figcaption></figure></div>

The above block results in the [Link](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/link) element (Company Link), for the ID *ST100* (Company 1), pointing to the Zingy website.

The next image shows an example of multiple element selection where the ID and ID2 values are not provided.

<div align="left"><figure><img src="https://3401585094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmnBepgycwgisXr9ya1N4%2Fuploads%2FgrK1xLJie8tYI0TjX9zZ%2Fimage.png?alt=media&#x26;token=ec60cb44-5e3e-4f3f-915a-d5286fecb554" alt="" width="518"><figcaption><p>Set Element Attribute in Data Design example 2</p></figcaption></figure></div>

This will result the [href](https://docs.zingy.ai/page-editor/built-in-elements/link#href) attribute of all the [Link](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/link) elements (in the selected [Data Design](https://docs.zingy.ai/app-editor/page-editor/built-in-elements/data-design)) having an empty value.
