# Handling Dynamic Form Creation with Unique IDs and Maintaining Input Values 

**URL:** <https://community.weweb.io/t/handling-dynamic-form-creation-with-unique-ids-and-maintaining-input-values/14778>\
**Category:** Ask us anything\
**Tags:** design\
**Created:** [December 2, 2024, 10:21am UTC](https://community.weweb.io/t/handling-dynamic-form-creation-with-unique-ids-and-maintaining-input-values/14778 "2024-12-02T10:21:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haroon](https://avatars.discourse-cdn.com/v4/letter/h/e47c2d/32.png) [@Haroon](https://community.weweb.io/u/Haroon)\
**Post date:** [December 2, 2024, 10:22am UTC](https://community.weweb.io/t/handling-dynamic-form-creation-with-unique-ids-and-maintaining-input-values/14778/1 "2024-12-02T10:22:00Z")

</div>

I created a `div` and added a button underneath it. Every time I click the button, I insert values into an array, and then I display those values as items. The number of `div`s shown corresponds to the number of times the button is clicked. However, the biggest issue is that when I store the `div` in the array, the form input values are not triggered. No matter what I write in the input fields, they remain empty. This issue is caused by the array.

Please help me so that when I click the button, a form `div` opens with a unique ID, like `sample 1`. Then, when I click again, the `div` is cloned with a unique ID like `sample 2`, and so on. The input values in the form must be triggered and displayed, whatever I write in the input fields.

 ![Screenshot_1](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/3/30ba9f89494714b414a0273f8078c38c935d1df0.png)  
 ![Screenshot_2](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/4/46c724abb2a4ed043b1d5b2d76ac8a93885665cc.png)  
 ![Screenshot_3](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/6df2fe260a29b16815eb291eaf7d59ebe6fbefa1.png)  
 ![Screenshot_4](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/77f0d621149a7edc1ee8cf505ff891d4df5dab20.png)  
 ![Screenshot_6](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/8/878b4f6567399d0b8d6c6aec34e5ec4aff8f1165.png)
