Skip Navigation

[Resolved] Toolset fields and gravity forms

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 6 replies, has 2 voices.

Last updated by leilaG 1 year, 11 months ago.

Assisted by: Shane.

Author
Posts
#2366117

Hello,

We are trying to pull through a toolset field into a gravity form on this page
hidden link

Gravity support team have informed us this should work this the below code
{custom_field:location}

But is does not work.

#2366209

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leila,

I'm assuming here that the location in the shortcode above is suppose to be the slug of the custom field correct?

If so then can you try this {custom_field:wpcf-location}

Thanks,
Shane

#2366957
location.png

Okay, I tried that, but it didn't work.

It is a taxonomy field that is pulled through on this page is it location 'MediCity Nottingham:
hidden link

#2367045

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leila,

Looking at this further, you're not trying to pull a toolset field into the form as the spaces post type doesn't what a location custom field.

What you're trying to do is to pull the location taxonomy term into the form. Does gravity forms have the ability to do this ?

If not then you will need to use the views shortcode get the current taxonomy.

[wpv-post-taxonomy type="location" format="name" show="name" ]

This shortcode should get the current page taxonomy.

Thanks,
Shane

#2367809

Hi Shane,

This is from Gravity support:

Gravity Forms doesn't provide any built-in merge tag to get a taxonomy term. If I understood correctly, you just want to be able to include the output that would generate the shortcode provided by Toolset support as part of the form values in your notification, right?

If so, you could do the following:

1. Add a Hidden field to your form.

2. Use the following filter to return the output of the shortcode to your field: hidden link

The following should work:
add_filter( 'gform_save_field_value_xx_yy', function ( $value, $lead, $field, $form ) {
$value = do_shortcode( '[wpv-post-taxonomy type="location" format="name" show="name" ]' );
return $value;
}, 10, 4 );

You need to replace xx in the first line of the snippet with your form id and yy with the id of your hidden field.

I added this in to the functions.php

/*Gravity form available space add location to form*/

add_filter( 'gform_save_field_value_43_10', function ( $value, $lead, $field, $form ) {
$value = do_shortcode( '[wpv-post-taxonomy type="location" format="name" show="name" ]' );
return $value;
}, 10, 4 );

But it’s not working for some reason

We was able to pull in another toolset field ‘Space ID’ using {custom_field:wpcf-id} but this isn’t a taxonomy field -
hidden link
This worked.

Any other ideas how we can get the taxonomy to show?
Thanks

#2367855

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Leila,

Before I can proceed further, the gravity forms team need to provide you with some code that works whether populating the field using their hook using a static value as a demonstration that shows that it works.

Once they can confirm that the hook works on the particular field that you're trying to populate then we can look into how to get the taxonomy to show in the field.

Thanks,
Shane

#2369185

My issue is resolved now. Thank you!

The code above was working, it only shows in the email notification as a hidden field in form which it what we wanted 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.