Loading...
X

{entry_id} is not populated in hidden field

8 0

The entry id is not known when the merge tags are processed on form load, you can force {entry_id} to be reprocessed when the fields are saved adding the following to your theme functions.php file:

add_filter( 'gform_save_field_value', 'replace_awkward_merge_tags', 10, 4 );
function replace_awkward_merge_tags( $value, $entry, $field, $form ) {
    $value = GFCommon::replace_variables( $value, $form, $entry );

    return $value;
}

And this is a version of the snippet to make the job only for certain form and field.

add_filter( 'gform_save_field_value', 'replace_awkward_merge_tags', 10, 4 );
function replace_awkward_merge_tags( $value, $entry, $field, $form ) {
  // replace form and field id numbers in the following line with your form and field id
  if ( $form['id'] == 1 && $field->id == 2 ) {
    $value = GFCommon::replace_variables( $value, $form, $entry );
    return $value;  
  } else {
    return $value; 
  }

}

Leave Your Observation

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