> For the complete documentation index, see [llms.txt](https://docs.dapta.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.dapta.ai/dforms/builder/hidden-fields-and-url-prefill.md).

# Hidden fields & URL prefill

Prefill any dForms question from the link with ?key=value, hide a question so it is filled only from the URL, copy the ready-made example from the Prefill from URL block, and understand precedence and

Every question in a form can be filled from the link that opens it. Add `?key=value` to the public URL and the answer arrives already typed in. Turn on **Hidden question** and the respondent never sees the question at all: the value from the link is stored with their submission, which is the easy way to pass a promo code, a campaign name or a lead source from your ads, emails or CRM into the form.

***

**Step 1:** In the editor, select a question and open **Advanced settings** in the **Question settings** pane. The first block is **Prefill from URL**. It is read only and shows your real public link with a sample value for this question, for example `/acme/f/lead-qualification-quiz?company=value`. Click **Copy** to copy it.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-3d62d21cc63cbb28a8ebe604fb0092d5528f9697%2Fforms-hidden-fields-and-url-prefill-01-prefill-block.png?alt=media" alt="The Prefill from URL block under Advanced settings showing the end of the form&#x27;s path with ?company=value, and a Copy button"><figcaption><p>Every question shows its own prefill link. The parameter name is the question's <strong>Field key</strong>.</p></figcaption></figure>

The parameter name is the question's **Field key** (editable further down in the same section). The sample value changes with the question type: an email question shows `ana%40acme.com`, a phone question `%2B15555550123`, a slider a number, a choice question the value of its first option. A Name question lists both parameters (`firstname` and `lastname` by default).

> **💡 Tip:** Values in a URL must be URL-encoded: `@` becomes `%40`, `+` becomes `%2B`, spaces become `%20`. Most tools that build links do this for you.

***

**Step 2:** To pass data the respondent should not see, turn on **Hidden question** under **Behavior**. The hint reads **Not shown to respondents. Its answer is filled from a matching URL parameter (?key=value).** The card in the question list gets a **Hidden** badge.

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-b3ab3ef5c2752da75a4c9fb09d510a5b0cf977bf%2Fforms-hidden-fields-and-url-prefill-02-hidden-toggle.png?alt=media" alt="The editor with a Promo code question selected, the Hidden question switch turned on and the Hidden badge on the question card in the list"><figcaption><p>A hidden <strong>Promo code</strong> question with the key <code>promo</code>. Respondents never see it; the link fills it.</p></figcaption></figure>

A few details about hidden questions:

* **Hidden** is available for every type except Message, Reveal screen and Scheduler (those have nothing to store). A **File upload** question offers the switch too, but a link cannot carry a file, so a hidden File upload is simply never answered.
* A hidden question is skipped in the progress bar and the step count, and it never blocks the respondent, even if it is marked **Required**.
* A hidden question never shares a Slides screen with other questions. Hiding a question that sits on a screen takes it off that screen; the hint under the switch says **Hiding it also takes it off its screen.** See [Several questions on one screen](/dforms/builder/screens.md).
* Its value is still submitted, so you can map it to a HubSpot property, send it in a webhook, export it to CSV and recall it later with `[promo]`. Hidden questions never add to the score.
* If the link carries no value, the question's **Default answer** is used. If that is empty too, the answer is simply empty.

***

**Step 3:** Keep field keys away from `utm_`. Keys that start with `utm_` are never read from the URL: the editor shows **A key starting with utm\_ is never read from the URL: those are captured separately as campaign data. Rename the key to make prefill work.**

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-4947c8fa0678387b82e8ce2f810d1bce05bb4501%2Fforms-hidden-fields-and-url-prefill-03-utm-warning.png?alt=media" alt="Advanced settings with the field key utm_promo and the red warning that a key starting with utm_ is never read from the URL"><figcaption><p>Rename the key (for example to <code>promo</code>) and prefill works again.</p></figcaption></figure>

You do not need a hidden question to track campaigns. `utm_source`, `utm_medium`, `utm_campaign`, `utm_term` and `utm_content` in the link are captured automatically with every submission and can be sent to HubSpot as form elements. Use hidden questions for anything that is not a UTM parameter: promo codes, lead source IDs, plan names, account IDs.

***

**Step 4:** Build the link and test it. Copy the example from the **Prefill from URL** block, replace `value`, and add more parameters with `&`:

```
https://app.dforms.ai/acme/f/lead-qualification-quiz?firstname=Jane&lastname=Doe&promo=SPRING25
```

<figure><img src="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-c1316c47491313ea66ce72762042ef8f60a51db5%2Fforms-hidden-fields-and-url-prefill-04-public-prefilled.png?alt=media" alt="The published form opened from a link with firstname and lastname parameters: the name step shows Jane and Doe already filled in"><figcaption><p>Opened from the link above: the name step is already filled. The hidden <code>promo</code> value is stored silently.</p></figcaption></figure>

The respondent can still change a visible prefilled answer before moving on.

## How values are resolved

When a question has several possible sources, this is the order, from weakest to strongest:

| Priority    | Source                                 | Notes                                                                               |
| ----------- | -------------------------------------- | ----------------------------------------------------------------------------------- |
| 1 (lowest)  | **Default answer** (Advanced settings) | "Used when the link carries no value. Anything in the URL wins over this."          |
| 2           | **URL parameter** `?key=value`         | Applies to visible and hidden questions. Values longer than 512 characters are cut. |
| 3 (highest) | **What the respondent types**          | Only for visible questions.                                                         |

Other rules worth knowing:

* Prefill works for every question that stores a value: contact fields, choices and dropdowns (use the option's stored value, not its label; open **Stored values** under the options to see it), text, website, slider (a number inside min and max). Message, Reveal and Scheduler steps ignore it. A **File upload** cannot be prefilled: its **Prefill from URL** example shows the key with no value.
* A prefilled visible question still has to pass validation when the respondent continues (a bad email is not accepted just because it came from the link).
* Prefill also works inside an embedded form: add the parameters to the `src` of the iframe.
* Only parameters that match a field key of the form are read. Anything else in the URL is ignored.

## What's next

* [Question settings](/dforms/builder/question-settings.md): field keys, default answers and what renaming a key changes.
* [Recall answers with @](/dforms/builder/recall-answers.md): show a prefilled value in a later question.
* [Form elements: UTMs, score, outcome, submitted date](/dforms/connect/hubspot/form-elements.md): send campaign data to HubSpot.
* [Your public link](/dforms/share/public-link.md): where the public URL comes from.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.dapta.ai/dforms/builder/hidden-fields-and-url-prefill.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
