title: Gravity forms plugin - dynamically populating form field isn't working
body: <p>I'm having some problems with my Gravity Forms form. It's a multi page form, and I need to populate a field on page 2 using post values from page 1. But it's not working. Of course the field on page 2 is configured to "Allow field to be populated dynamically" and the field's parameter is set to "name".
  Here's my code:</p>
  
  <pre class="lang-php prettyprint-override"><code>add_filter('gform_field_value_name', 'name_population_function');
  function name_population_function($value){
      $name = $_POST['input_2'] . ' ' . ( ! empty( $_POST['input_3'] ) ? ( $_POST['input_3'] . ' ' ) : NULL ) . $_POST['input_1'];
      return $name;
  }
  </code></pre>
  
  <p>When I print the value of <code>$name</code> variable using <code>var_dump($name);</code> it's actually correct.</p>
  
  <p>If I change the <code>$name</code> to <code>$name = 'Last Middle First';</code> it's populating the field as it should.</p>
  
  <p>Thank you for your help.</p>
  
  <p>EDIT:
  For test purposes I changed my code to:
  </p>
  
  <pre><code>add_filter('gform_field_value_name', 'name_population_function');
  function name_population_function($value){
      $name = 'Test';
      if ( ! empty( $_POST['input_1'] ) &amp;&amp; ! empty( $_POST['input_2'] ) ) {
          $name = $_POST['input_2'] . ' ' . ( ! empty( $_POST['input_3'] ) ? ( $_POST['input_3'] . ' ' ) : NULL ) . $_POST['input_1'];
      //var_dump( $name );
      }
      return $name;
  }
  </code></pre>
  
  <p>If I uncomment the line with <code>var_dump</code> the value of variable <code>$name</code> is again set correctly, but the field on page 2 is prepopulated with value <code>Test</code>. Probably this filter is also called on page 1 so is it possible that the plugin caches this value? I don't use a caching plugin, so don't know why it's not working.</p>