• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Simplify

Simplify

WordPress Development

  • Blog
  • Form Examples
  • Contact Us

Dynamically populate an html field or a form input field on page 2 with a value obtained from an input field on page 1

Click here to see an example

Form Fields

  • Page 1
    • Text field
  • Page 2
    • HTML Block (contains javascript)
    • HTML Block (contains paragraph with element to insert the value obtained from page 1
    • Text Field (value obtained from page 1 is inserted into this field.

The Code

HTML Block 1 Javascript

<script type="text/javascript">
    jQuery(document).on('gform_post_render', function (event, form_id, current_page) {

        // code to trigger on form or form page render
        if (current_page == 2) {
            // Get the value from page 1
            var x = document.getElementById("input_7_14").value;
            // form_id == 7
            // field id == 14 
            //   this is the field on page 1
            // field id == 14 
            document.getElementById("bs_insert_word").innerHTML = x;
            document.getElementById("input_7_9").value = x;
        }
    })
</script>

HTML Block 2 with paragraph setup to include input from form 1

The word '<span id="bs_insert_word"></span>' from page one has been inserted in this paragraph.

Screenshot of form

Filed Under: Gravity Forms, Javascript December 6, 2022 Leave a Comment

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Categories

  • Gravity Forms
  • Gravityflow
  • Javascript
  • LegalSigning
  • Uncategorized

Footer

Design

With an emphasis on typography, white space, and mobile-optimized design, your website will look absolutely breathtaking.

Learn more about design.

Content

Our team will teach you the art of writing audience-focused content that will help you achieve the success you truly deserve.

Learn more about content.

Strategy

We help creative entrepreneurs build their digital business by focusing on three key elements of a successful online platform.

Learn more about strategy.

Copyright © 2023 · Genesis Sample on Genesis Framework · WordPress · Log in