Support

Account

Home Forums General Issues Populating Gravity Form from ACF field in a tab layout

Helping

Populating Gravity Form from ACF field in a tab layout

  • I am populating Gravity Form fields with post data using gform_field_value_xxx using the Hooks method.

    add_filter('gform_field_value_funder_name', 'set_funder_name');
    function set_funder_name($value){
      return get_field('funder_name');
    }

    The ACF fields are setup using a Tab layout feature of ACF in the backend of WordPress. Fields that are setup on the first tab work fine, but any field that’s on a later tab (ie: Application Criteria, Past Grantees, etc) won’t pre-populate into the form. When I try and output the fields information within the gform_field_value_xxx function, it shows up as blank.

    ACF Tabs

    Is there anything additional that needs to be added to this function in order to work on a tabbed layout? Or should I remove the layout entirely?

    Thanks

  • Your function would only update one Gravity Form field with the one ACF field.

    Looking at the GF Docs, you can see:

    add_filter( 'gform_field_value_your_parameter', 'my_custom_population_function' );
    function my_custom_population_function( $value ) {
        return 'boom!';
    }

    This snippet would populate any field with the parameter your_parameter with the result of the function my_custom_population_function. In this example, that function returns the string boom!.

    So I think you would need to repeat this for each field you wish to populate.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.