# HS pre-filled required input value returns required validation error

**URL:** <https://community.hubspot.com/t/hs-pre-filled-required-input-value-returns-required-validation-error/87302>\
**Category:** CMS Development\
**Tags:** professional\
**Created:** [August 11, 2023, 12:55pm UTC](https://community.hubspot.com/t/hs-pre-filled-required-input-value-returns-required-validation-error/87302 "2023-08-11T12:55:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmadusanka](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@dmadusanka](https://community.hubspot.com/u/dmadusanka)\
**Post date:** [August 11, 2023, 12:55pm UTC](https://community.hubspot.com/t/hs-pre-filled-required-input-value-returns-required-validation-error/87302/1 "2023-08-11T12:55:08Z")

</div>

I have a required email field in a HS form. And I pre-fill it with jquery. In the form, I can see the pre-filled value. But when I click the submit button, it returns “Please complete this required field.” even though the value is set. Can someone suggest a solution for this, please? Highly appreciate your support.

This is how I set the value

$(“input[name=‘email’]”).val(‘sample@mail.com’).change();

---

<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:** [August 14, 2023, 3:24pm UTC](https://community.hubspot.com/t/hs-pre-filled-required-input-value-returns-required-validation-error/87302/2 "2023-08-14T15:24:25Z")

</div>

Hey, @dmadusanka 👋 Welcome to our community! Thanks for your question. Did you get this worked out?

Have you already tried triggering a form validation event after setting the value? This can be done by calling the `form.trigger(“submit”)` method, where `form` is the jQuery selector for your form. To try to trigger the form validation to re-evaluate the field value?

Best,

Jaycee

---

<div class="post-metadata">

**Author:** ![dmadusanka](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@dmadusanka](https://community.hubspot.com/u/dmadusanka)\
**Post date:** [August 21, 2023, 9:46am UTC](https://community.hubspot.com/t/hs-pre-filled-required-input-value-returns-required-validation-error/87302/3 "2023-08-21T09:46:10Z")

</div>

Thank you [@Jaycee\_Lewis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/127074) for your support. I found a solution. I dispatch the change event using “emailInput.dispatchEvent(new Event(‘change’));”. This cord works. But there is another issue. I need to disable this email input so that the user cannot change the email. When I do it, this will not work again. For now, I just remove the disabled attribute from this email input.
