It is sometimes quite useful to be able to pre-populate fields on a form, or to be able to pass parameters to a form so that fields are pre-filled with information you already have, or so that on form submission some additional data gets passed along with the values that the user has supplied.
Passing Parameters to Hosted Forms
You can dynamically pre-populate fields by passing in their default values in the URL. The URL format to do this is:
&init_FIELDNAME=FIELDVALUE
Each component you've added to a form has its own unique "Name". To find the name click on the field and in the left hand side properties menu it will have a value right at the top called "Name" that looks something like this:
For each field which you would like to dynamically populate with a value that comes from the forms URL, simply append &init_FIELDNAME=FIELDVALUE to the forms URL.
For example for the link below which is a link to a demo form, we're pre-populating one of the fields with some custom text that says "PRE-POPULATED-VALUE-GOES-HERE". Try it out by clicking on the link below, you will see whatever we type in the URL will be pre-populating that field:
This is very handy for times where you already know something about the user and wish to pre-populate fields on the form for them. You can also use this to pass additional information to your form by making certain form fields "readonly", or "hidden" but which are pre-populated with values via the URL, so that when the form gets submitted you have extra information stored (e.g. campaign codes or marketing information), and they will show up in your reports together with what the user supplied when they submitted the form.
Passing Parameters without the end user being involved
If you would like parameters to be passed to the form without the end user being aware or involved, follow the same steps as above except also set the fields which are going to be pre-populated to be marked as "Hidden" so they don't appear to your end users. For example below we have added a text field to the form, and marked it as hidden as it is intended to be pre-filled with a marketing value that does not concern the end users but that we still want submitted with the rest of the form field values:
Passing Parameters to Embedded Forms
To pass parameters to an embedded form, in its embed script you can add initialisation parameters in the format init_FIELDNAME=FIELDVALUE , for example below we are pre-populating two fields on the embedded form:
<script id="global_patron_form_widget_script"
src="https://www.globalpatron.com/production/gp_widget_embed.min.js"
form_id="xxx"
init_gpi_xxxxxxxx="James"
init_gpi_xxxxxxxx="Smith"
form_type="classicmulti"
form_height="auto"></script>
Note: Each component you've added to a form has its own unique "Name". To find the name click on the field and in the left hand side properties menu it will have a value right at the top called "Name" that looks something like this:
Alternative
Alternatively if the "default" value you would like to pre-populate into a field never changes, you can assign a static default value to fields by entering it in the fields "Default Value" property: