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?
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.