APIs & Integrations

AhmedAmer
Member | Elite Partner
Member | Elite Partner

Embedded form: populated fields get deleted on submit

Hi, 

 

I have seen similar posts about this issue but none had a solution. namely: Embedded form clears prepopulated fields on focus/submit 

 

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.

 

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.

0 Upvotes
2 Replies 2
JBeatty
Guide | Diamond Partner
Guide | Diamond Partner

Embedded form: populated fields get deleted on submit

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" 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" which was successful for me.

 

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

Jaycee_Lewis
Community Manager
Community Manager

Embedded form: populated fields get deleted on submit

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

 

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes