Pre-populate a form field value on generate.js rendered Forms

Hi Community

I really like the automated Mautic Form HTML using the links /form/generate.js?id=FROM-ID :slight_smile:
I’m looking for an easy way to define some prefilled forms, (e.g. the Context of Form Submits)

Search throught the forums I’ve found only this post which allows prefilled form on mautic hosted landing pages: How to pass URL parameters to a form


Is there a similar solution to define prefilled, mostly hidden fields, for forms delivered by the automated html using the /form/generate.js?id=FROM-ID?

The only solution I’ve found is copy the manual Form HTML Code, and injecting the hidden fields manually, as it’s described here. https://docs.mautic.org/en/components/forms/managing-forms?_ga=2.108267458.1789075526.1599224912-1278022431.1599224912#pre-populate-a-form-field-value

Unfortunately this breaks the simplicity of the generate.js Forms and needs a lot of maintenance when changing forms and their fields.

What I’m looking for is something like this:

<script type="text/javascript" src="https://mautic.org/form/generate.js?id=1&product_id=MY-PREDEFINED-VALUE" async="async"></script>

where product_id is the hidden field, used to distinguish the context of the shared contact form.

Is something like this available or planned?

Thanks a lot for your feedbacks :smiley:


ps: Is there a place to customize the output of the script generate.js? I couldn’t find it in the source easily.