# Embedded form: populated fields get deleted on submit

**URL:** <https://community.hubspot.com/t/embedded-form-populated-fields-get-deleted-on-submit/65021>\
**Category:** APIs & Integrations\
**Tags:** forms\
**Created:** [September 13, 2022, 7:18pm UTC](https://community.hubspot.com/t/embedded-form-populated-fields-get-deleted-on-submit/65021 "2022-09-13T19:18:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AhmedAmer](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@AhmedAmer](https://community.hubspot.com/u/AhmedAmer)\
**Post date:** [September 13, 2022, 7:18pm UTC](https://community.hubspot.com/t/embedded-form-populated-fields-get-deleted-on-submit/65021/1 "2022-09-13T19:18:06Z")

</div>

Hi,

I have seen similar posts about this issue but none had a solution. namely: [Embedded form clears prepopulated fields on focus/submit](https://community.hubspot.com/t5/APIs-Integrations/Embedded-form-clears-prepopulated-fields-on-focus-submit/m-p/230086)

I am here hoping to find a solution since there has been no activity since 2019.

I have a hubspot form that I am using to create support tickets. I am trying to prefill the form with known user information (since they are logged in). I have followed the documentation and have the following.

I am using the onFormReady event that is fired when the form is loaded.

```lia-code-sample
onFormReady: (form) => {
 var jForm = $(form);
 var email = jForm.find("input[name$='email']")
 .val("test@gmail.com).change();
}

```

This works initially and the field is prefilled. However, as soon as I press submit the field is erased and I get an error saying that an email is required.

I have tried many different options and can’t seem to find any that work. Can someone please help?

Thanks.

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 15, 2022, 6:35pm UTC](https://community.hubspot.com/t/embedded-form-populated-fields-get-deleted-on-submit/65021/2 "2022-09-15T18:35:59Z")

</div>

Hi, @AhmedAmer 👋 Thanks for including those details. Hey, @tjoyce @JBeatty, do you have any insight or troubleshooting tips for @AhmedAmer?

Thank you! — Jaycee

---

<div class="post-metadata">

**Author:** ![JBeatty](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jbeatty/32/52252_2.png) [@JBeatty](https://community.hubspot.com/u/JBeatty)\
**Post date:** [September 19, 2022, 9:47pm UTC](https://community.hubspot.com/t/embedded-form-populated-fields-get-deleted-on-submit/65021/3 "2022-09-19T21:47:17Z")

</div>

Hi @AhmedAmer,

Testing your code with a different email address works great for me, so I believe the issue is actually with the email that you chose. “[test@gmail.com](mailto:test@gmail.com)” is not a valid email according to HubSpot, so it will not accept that email, and ask for a new email. Could you try running your code with a different email like “[test1234@gmail.com](mailto:test1234@gmail.com)” which was successful for me.

Best,
