Submitting hidden fields in account creation form

I’m trying to add UTM params as user custom fields when the user creates an account. My plan was the following:

  • Add user custom fields in Discourse admin settings
  • Parse the UTM params from the URL and store them in a cookie, so they are accessible at any time
  • Set hidden input values in the account creation form
  • Fill the value of these hidden fields with the corresponding value with jQuery

However, there is an issue with the fields in the form that seems to be caused by the need to click on them – in the same way the password field needs to be clicked on in order to trigger the validation and eventually enable the form to be submitted.

Anyone has an idea of how to circumvent this issue with jQuery?

1 Like

In case it helps someone, I was missing triggering an event. For example:
$('.user-field.user-field-utm_source input').trigger('change');