onFormReady callback population triggers an error


#1

I want to fill some fields with users information on creation time (using onFormReady callback)

hbspt.forms.create({
  ...
  onFormReady: function onFormReady($form, ctx) {
    ...
    $form.find('input[name="email"]').val(user.email).change()
  }
})

field has a proper value but also triggers a required field error, I figured out a hacky fix but I would feel better without it

setTimeout(() => {
  $form.find('input[name="email"]').val(user.email).change()
}, 100)