How to get value from URL when embedding your forms
Pre-populating your forms is possible thanks to the Get value from URL option under field settings. If you plan to embed your forms and wonder how to use this feature, here is how:
1. Go to the Share page and copy the embed code of your form:

An image showing the “Share” section of your form, where you can copy the embed code from the options below
2. Go back to the Build section and enable the Get value from URL option in the field needed:

An image showing the “Build” section of your form, where you need to activate the “Get value from URL” option for the required field
3. Copy the code between “#” and “=”. After “#”, you have your field ID, and after “=”, you have your field value that will be entered to the field:

An image showing the “Build” section of your form, where you need to activate the “Get value from URL” option for the required field
4. Turn the code you copied earlier into the following format:
"answers": { "field ID": "field value"}
e.g. "answers": { "63ebad419442ad0448b9e9b6": "XXXX"}
5. Add this code under "height" and copy it. Your embed code should look like this:
<div formsappId="640766432fde613d93222a7e"></div> <script src="https://forms.app/static/embed.js" type="text/javascript"></script> <script> var formsappForm = new formsapp('640766432fde613d93222a7e', 'standard', { "width": "100vw", "height": "600px", "answers": { "63ebad419442ad0448b9e9b6": "XXXX" } }) </script>
Now you can pre-populate your forms when embedding them on a web page. This opens up whole new possibilities for you. For example, you can fetch a user name, email address, or full name to show in your forms by using a special script for your website.
1. Add a short text field to your form and open the "Get value from URL" option. This will give you a unique identifier, which we will use later on.
2. Optionally, you can make this field hidden and read-only, so the form respondents cannot see or change the answer.
3. Then head over to the share page and get the embed code. We recommend the script method.
4. Replace the fieldID of the following text with the identifier from the short text field (It's after the # and before the = sign): , "answers": { "63ebad419442ad0448b9e9b6":window.location.href}
5. Keep the comma at the beginning and add the code above right after "height": "600px"
6. In the end, your embed code should look like this:
<div formsappId="66992035dab6ee9357fcc8db"></div>
<script src="https://forms.app/cdn/embed.js" type="text/javascript" async defer onload="new formsapp('66992035dab6ee9357fcc8db', 'standard', {'width':'100vw','height':'600px',answers:
'66992058739bc858fc8dffa0': window.location.href
}}, 'https://content-marketing.forms.app');"></script>
This way, you will capture the page url where the form is submitted. If you have further questions or need assistance, we'd be glad to help.
