Mautic Community Forums

Pass variables to form embedded in WordPress page

Hi,



when I am embedding a form in a Mautic landing page, I am able to pass form values via URL parameter (e.g. emailadresse=info@test.de) which is then pre-filled into the form.



When I am embedding the same form into a WordPress page (either manual or automatic copy) this does not work.



Any idea on…

…why it does not work?

…how to pre-fill values from URL parameter?



Thank you,



Peter

Hi,

when I am embedding a form in a Mautic landing page, I am able to pass form values via URL parameter (e.g. emailadresse=info@test.de) which is then pre-filled into the form.

When I am embedding the same form into a WordPress page (either manual or automatic copy) this does not work.

Any idea on…
…why it does not work?
…how to pre-fill values from URL parameter?

Thank you,

Peter

Yes, I pasted the CSS, the HTML and the JavaScript code. The form itself works fine but the URL parameters are not inserted into the fields.

Use hidden fields and fill them using JS?

Is there an easy way to do this? I am not really familiar with JS.

$(document).ready(function() { $(’#idOfFieldInput’).val(“yourvalue”); });

This is using jQuery. And I am posting this from my phone, so believe me it’s not tested code :slight_smile: But you should get an idea, right?

Best,
D.

I can’t get it to work and I am not sure how to debug it.

For the current campaign, I am going back to a Mautic landing page. But I will keep testing with WordPress.

I had the same problem in a membership plugin and i solved via php.

  1. open plugin editor and i found the file that creates the form
  2. add at the top of that file these lines:

<?php $email = isset($_GET["email"]) ? $_GET["email"] : ""; $first_name = isset($_GET["first_name"]) ? $_GET["first_name"] : ""; ?>

email and first_name are the value used by plugin in wordpress form… you can change them by your needs