{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-embeds/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Passing data to your form","description":"Build integrations, automate workflows, and manage forms and responses programmatically with the forms.app API.","siteUrl":"https://developers.forms.app","image":"/assets/formsapp-developer-docs.6ffba4f5ff7d394698661bcdb0ed2a8452f27acaf4e82754e5d0f4109563471c.9c1bb791.png","lang":"en-US","projectTitle":"forms.app Developer Docs","llmstxt":{"sections":[{"title":"llmtxt for forms app documents","includeFiles":["**/*"],"excludeFiles":[]}]},"jsonLd":{"@context":"https://schema.org","@type":"Organization","additionalType":"https://en.wikipedia.org/wiki/Software_as_a_service","url":"https://forms.app","name":"forms.app","logo":"https://cdn.forms.app/icons/all/brands/formsapp-logo-dark.svg","description":"forms.app is a free online form builder designed for teams. forms.app offers a modern, easy-to-use form builder and allows unlimited responses and team members.","foundingDate":"2018","sameAs":"https://linkedin.com/company/formsapp","contactPoint":{"@type":"ContactPoint","contactType":"Customer service","email":"support@forms.app","url":"https://forms.app/en/contact-us"}}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"passing-data-to-your-form","__idx":0},"children":["Passing data to your form"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Prefill fields or pass along context from your page, such as a referral code, a plan name, or a UTM parameter, into an embedded form. This works on any ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/embeds/script-embed"},"children":["script embed"]}," layout through the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["answers"]}," option."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-enable-get-value-from-url-on-a-field","__idx":1},"children":["1. Enable \"Get value from URL\" on a field"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Open the form in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Build"]}," section of forms.app."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select the field you want to prefill."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In the field's settings, turn on ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Get value from URL"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Copy the field ID shown, the part between ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["#"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["="]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-pass-the-value-in-your-embed-code","__idx":2},"children":["2. Pass the value in your embed code"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["answers"]}," key to the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["options"]}," object, alongside ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["width"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["height"]},". It maps field IDs to the values you want prefilled:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<script src=\"https://cdn.formsapp.io/embed.js\" type=\"text/javascript\" async defer onload=\"new formsapp('69d4bd130b443bda40c8f65a', 'standard', {'width':'100vw','height':'600px','answers':{'63ebad419442ad0448b9e9b6':'XXXX'}}, 'https://eu.forms.app');\"></script>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["answers"]}," accepts one entry per field you want to prefill; every value is a string."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"reading-the-value-from-your-own-pages-url","__idx":3},"children":["Reading the value from your own page's URL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["forms.app doesn't parse your page's query string automatically. Read the value yourself, before constructing the embed call:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<script>\n  const params = new URLSearchParams(window.location.search);\n  const referral = params.get('ref') || '';\n</script>\n<script src=\"https://cdn.formsapp.io/embed.js\" type=\"text/javascript\" async defer onload=\"new formsapp('69d4bd130b443bda40c8f65a', 'standard', {'width':'100vw','height':'600px','answers':{'63ebad419442ad0448b9e9b6': referral}}, 'https://eu.forms.app');\"></script>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The two ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<script>"]}," tags run in the same page scope, so the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onload"]}," handler in the second one can reference ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["referral"]}," from the first."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"capturing-the-full-page-url","__idx":4},"children":["Capturing the full page URL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To store the referring page's URL itself, rather than a single query parameter, enable ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Get value from URL"]}," on a short text field and pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["window.location.href"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<script src=\"https://cdn.formsapp.io/embed.js\" type=\"text/javascript\" async defer onload=\"new formsapp('69d4bd130b443bda40c8f65a', 'standard', {'height':'formHeight','answers':{'FIELD_ID': window.location.href}}, 'https://eu.forms.app');\"></script>\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Hide the field"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If a field is only there to capture passed-in data and isn't meant for the visitor to fill in themselves, mark it hidden and read-only in the Build section."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"whats-next","__idx":5},"children":["What's next"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/embeds/examples"},"children":["Examples"]}," for the idiomatic way to read query parameters in React, Next.js, Vue, and Kotlin."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/embeds/script-embed"},"children":["Script embed"]}," for the full ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["formsapp()"]}," reference."]}]}]},"headings":[{"value":"Passing data to your form","id":"passing-data-to-your-form","depth":1},{"value":"1. Enable \"Get value from URL\" on a field","id":"1-enable-get-value-from-url-on-a-field","depth":2},{"value":"2. Pass the value in your embed code","id":"2-pass-the-value-in-your-embed-code","depth":2},{"value":"Reading the value from your own page's URL","id":"reading-the-value-from-your-own-pages-url","depth":2},{"value":"Capturing the full page URL","id":"capturing-the-full-page-url","depth":2},{"value":"What's next","id":"whats-next","depth":2}],"frontmatter":{"seo":{"title":"Passing data to your form"}},"lastModified":"2026-08-18T10:09:54.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/embeds/passing-form-data","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}