### [How to Pre-Populate Fields in the Same Form](https://wpforms.com/developers/how-to-pre-populate-fields-in-the-same-form/)

**Published:** March 21, 2022
**Author:** Editorial Team

**Excerpt:** This tutorial will walk you through how to take values entered from a field and pre-populate another field inside the same form. 

**Content:**

Interested in pre-populating fields on your form with values from other fields within the same form? With JavaScript, you can make this happen. In this guide, we’ll lead you through the process of creating your form and incorporating a snippet that will extract the Name field from page one of the form and automatically populate the Name field on page two of the same form.

## Creating the form

For this tutorial, we’re creating a multi page form that will have a **Name** field on both pages of the form.

If you need any assistance creating a multi page form, [please review this documentation](https://wpforms.com/docs/how-to-create-multi-page-forms-in-wpforms/ "How to Create Multi-Page Forms in WPForms").

![create the multi page form](https://wpforms.com/wp-content/uploads/2022/03/multi-page-wpforms-pre-populate.jpg)

The **Name** field **Format** for the purpose of this tutorial is set to **Simple**. ![set the name field format to Simple](https://wpforms.com/wp-content/uploads/2022/03/wpforms-name-field-format.jpg)

## Pre-populating the fields

In order to pre-populate fields in the same form, we’ll need to add this snippet to our site.

If you need assistance in how and where to add snippets to your site, [please check out this tutorial](https://wpforms.com/developers/how-to-add-custom-php-or-javascript-for-wpforms/ "How to Add Custom PHP or JavaScript for WPForms").

```

/**
 * Populate fields in the same form
 *
 * @link https://wpforms.com/developers/how-to-pre-populate-fields-in-the-same-form/
 */

function wpf_dev_name_change() {
    ?>

**Categories:** Extending

**Tags:** Javascript, JS

---

