Mautic Community Forums

Prepopulating mautic form with variables from URL

Hi All
I would like to know if there are any guides and or suggestions to prepopulate a mautic form which is embedded on a website.
I have seen numerous ways to do this, including php, javascript etc

I am looking for a solution which will do this
domain.com/contact?name=abcxyz

And the above will populate the form.

Any assistance would be appreciated.
M.

Exactly how it supposed to work.

You need to use the Custom field alias as GET value.
I tested and doesn’t work for me on 4.0.1, might be a bug or I’m using the wrong format.
J

@joeyk Thanks. main issue is that its not working :wink:
I was hoping we could add a variable to a url where the form resides and the data would be pre-filled. But this is not the case.
Any other suggestions?
M

@raramuridesign you are aware of this?
https://docs.mautic.org/en/components/forms/managing-forms?&_ga=2.261790990.2013470482.1634711414-1285334467.1631117015#pre-populate-a-form-field-value

And there is also another discussion going on here:

Did you try testing in incognito mode?

@adiux @rcheesley
I think perhaps this was not explained correctly. Our requirement was to use a variable from the CMS we are using to populate into the form. we have used PHP code to do this, grabbing the variable from the URL.

I was hoping that these could be achieved by default onto the form form, but sadly not.
Anyway our approach works, as long as we do not use the JavaScript integration.

Hi,
Just tested, and it works in 4.0.1, I didn’t test correctly before my answer above.
You have to make sure, that this setting is on in your form field, that you want to pre-populate:

image

Once, this is selected, the form can be prepopulated by calling the page with
https://yourmautic.tld/landingpagealias?email=desiredemail@email.com

1 Like

@joeyk Thanks, will test and see what the outcome is. Never seen this setting before so good to know it is there.