Gravity forms plugin - dynamically populating form field isn't working Gravity forms plugin - dynamically populating form field isn't working wordpress wordpress

Gravity forms plugin - dynamically populating form field isn't working


Rather than having the form over multiple pages, you could use jQuery to create the impression of multiple pages with .hide or .slideToggle. This would resolve your problem and make the submitting of the form data much easier. Then simply call the value from past inputs.


You could use a query string to persist the data and populate the field dynamically.

http://siteurl.com/form-url/?your_parameter=value

add_filter('gform_field_value_author_email', 'populate_post_author_email');function populate_post_author_email($value){global $post;$author_email = get_the_author_meta('email', $post->post_author);return $author_email;}


Try this gform_pre_render filter instead. It adds a filter to form ID 7. Replace 7 with your Gravity form's ID.

add_filter('gform_pre_render_7', 'populate_form_pre_render');function populate_form_pre_render($form){  $name ='';  foreach ($form['fields'] as &$field)  {     // replace 2 with the actual ID of your form field     if ( 2 == $field['id'] ){      if ( ! empty( $_POST['input_1'] ) && ! empty( $_POST['input_2'] ) ) {         $name = $_POST['input_2'] . ' ' . ( ! empty( $_POST['input_3'] ) ? ($_POST['input_3'] . ' ' ) : NULL ) . $_POST['input_1'];        //var_dump( $name );      }      $field['defaultValue']=$name;  echo '<pre>';  print_r($field);  echo '</pre>';   }     } return $form;}