# Prefilling Forms

Input Web Controls display the value of the Variable they are bound to, regardless of how that value was configured. This makes it possible to design forms that come prefilled with data that displays in the Input Web Controls as though the form was already filled out. Designing forms in this way allows the user to edit the data directly if necessary while also preventing them from needing to re-enter information that’s already been established.

In practice, the data that prefills a form is typically pulled from an existing source, like AirData or an external API, although it can also be a summary of information provided earlier in the Journey itself.

To demonstrate how this works, let’s take a look at this form from the "Flight School 101" App Template.

If we Preview this form as it comes out of the box, we’ll see that it does not come prefilled. The variables bound to each of the input boxes are empty, and if a user wanted to fill out the form, they would need to enter each field from scratch.

<figure><img src="https://4185914948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSItjRhbHaLQ4ar3DUljt%2Fuploads%2Fgit-blob-e7f589271490388af90cbe7ee1274be2de3b09ac%2Fprefilling-forms-v181-0.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

However, if we assign values to the relevant Variables before or while the Web Page loads, the form will load pre-filled. Values can be assigned to Variables in different ways, such as using a [Set Variable Action](../../actions/the-set-variable-action), or binding the Variable to the output of a Data Flow.

In the example below, we’ll add some Set Variable Actions to fire when the Web Page is viewed and hardcode Values to the form’s Variables:

![](https://4185914948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSItjRhbHaLQ4ar3DUljt%2Fuploads%2Fgit-blob-0f0ecf7642e3c463d55e09fc1d7e344eb98e2a56%2Fprefilling-forms-v181-1.png?alt=media)

If we Preview again, now the Input boxes come auto-populated with the values assigned to them:

<figure><img src="https://4185914948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSItjRhbHaLQ4ar3DUljt%2Fuploads%2Fgit-blob-9a310906a392b6845bba8eda669155275590e16a%2Fprefilling-forms-v181-2.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

Users can edit the pre-filled information as needed before proceeding. Changes will overwrite the Values used to auto-populate the form.

<figure><img src="https://4185914948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSItjRhbHaLQ4ar3DUljt%2Fuploads%2Fgit-blob-9a71159176940f20305a340082019ab3cd63dac1%2Fprefilling-forms-v181-3.png?alt=media" alt="" width="300"><figcaption></figcaption></figure>

## Discussion

While the example above presents a way to pre-populate a form in the simplest of ways, in practice, most applications look up data from other systems, like AirData:

![](https://4185914948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSItjRhbHaLQ4ar3DUljt%2Fuploads%2Fgit-blob-1c09f4f93c24f4ce4dc480b4598dff523e62fa46%2Fprefilling-forms-v181-4.png?alt=media)

Or from an external system:

<figure><img src="https://4185914948-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSItjRhbHaLQ4ar3DUljt%2Fuploads%2Fgit-blob-6cfa4555ef736fd1594ce3adaa366ffc68261466%2Fprefilling-forms-v181-5.png?alt=media" alt="" width="400"><figcaption></figcaption></figure>

For example, data can be automatically collected if a Journey started via incoming call or text. The calling number is saved under `session.start` to be then used as a lookup.
