# Fields of modal get emptied when modal is hidden

**URL:** <https://community.weweb.io/t/fields-of-modal-get-emptied-when-modal-is-hidden/8719>\
**Category:** How do I?\
**Tags:** design\
**Created:** [May 22, 2024, 12:13pm UTC](https://community.weweb.io/t/fields-of-modal-get-emptied-when-modal-is-hidden/8719 "2024-05-22T12:13:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unlustucru](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@unlustucru](https://community.weweb.io/u/unlustucru)\
**Post date:** [May 22, 2024, 12:13pm UTC](https://community.weweb.io/t/fields-of-modal-get-emptied-when-modal-is-hidden/8719/1 "2024-05-22T12:13:16Z")

</div>

I’d like to prevent the fields of a modal to get emptied when that modal gets hidden.

The hide/show behavior uses the `display` property rather than conditional rendering, so I’d expect that the field values would remain.

Can someone explain why the values get reset, and how I can force the opposite behavior?

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [May 24, 2024, 4:58pm UTC](https://community.weweb.io/t/fields-of-modal-get-emptied-when-modal-is-hidden/8719/2 "2024-05-24T16:58:49Z")

</div>

Hi @unlustucru 👋

Indeed I would expect the values to remain when you’re using the CSS display property as opposed to conditional rendering.

I was able to reproduce this on my side (the input value persists when I close the modal but is reset when I reopen it):  
 ![CleanShot 2024-05-24 at 18.56.29](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/7/7103b4a2110bbcfcd5f1d6811961f710e57627bf.gif)

Let me check with the tech team if it’s a bug or expected.

---

<div class="post-metadata">

**Author:** ![unlustucru](https://avatars.discourse-cdn.com/v4/letter/u/e36b37/32.png) [@unlustucru](https://community.weweb.io/u/unlustucru)\
**Post date:** [June 22, 2024, 5:49pm UTC](https://community.weweb.io/t/fields-of-modal-get-emptied-when-modal-is-hidden/8719/3 "2024-06-22T17:49:47Z")

</div>

Hi @Joyce, were you able to check with your team?
