Skip Navigation

[Resolved] Create "Request more info" form with automatic "Listing ID" custom field

This support ticket is created 3 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

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 4 replies, has 3 voices.

Last updated by HugoD4198 3 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#2068955

Tell us what you are trying to do?
I'm developing a used machine listings website and want to include a "Request more info" Form to be displayed in each machine Content Template page so that users can request more info about the machine they're seeing. I believe the best way is to create a CPT for contacts along with the customs fields I need and then create a form to include in the Content Template, right? The challenge is that I want to automatically include in this form the Listing ID of the machine that the user is interested in, so that when I receive the email request for more info I know what's the machine the user is refering to. The machine listing ID is in another CPT called "Equipments". Can I do this with Toolset?

Please be aware that I have no coding experience at all.

Is there any documentation that you are following?
Toolset Forms

Is there a similar example that we can see?
hidden link

What is the link to your site?
(it's still under development)
hidden link
(It currently includes a Kadence Form that I was experimenting with but I guess it's better to do it with Toolset)

#2069441
Screen Shot 2021-05-26 at 4.58.03 PM.png

The challenge is that I want to automatically include in this form the Listing ID of the machine that the user is interested in, so that when I receive the email request for more info I know what's the machine the user is refering to. The machine listing ID is in another CPT called "Equipments". Can I do this with Toolset?

Hi, it sounds like you have a CPT "Equipments" that includes the Listing ID information you need, and you want to include that Listing ID information in a Form that creates "Contact" CPT posts. Assuming the Form to create Contact posts is displayed in the template for Equipment posts, and Listing ID is a custom field in Equipment posts, you have access to that custom field with a shortcode like this somewhere in your Form:

[types field="listing-id-field-slug" item="$current_page"][/types]

That would give you the Listing ID from the current Equipment post. Let's say your Contact post type has its own custom field to store the ID of the item the site visitor is interested in. In the Form that creates Contact posts, you could automatically set that custom field value by adding the shortcode I included above as the field's default value. See the screenshot here for a similar example of the default option set by a shortcode.

So that would store the listing ID from the current Equipment post in the new Contact post created by Forms. Would that give you the information you need, or am I misunderstanding the setup and requirement here?

#2070189

Hello, many thanks. This is exactly want I want and your solution works perfectly.

If I want to use the Equipment's "Post ID" (generated automatically by WordPress), instead of the Equipment's "Listing ID" (custom field manually created by me ) how should I proceed? I tried to change the slug in your shortcode to "post-id" but it didn't work. Thank you in advance!

#2071329

Shane
Supporter

Languages: English (English )

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

Hi Hugo,

Christian is currently on vacation at the moment, however if I understand the issue correctly, you want to use the ID of post of the Current page rather than the custom field value that you've specified correct?

In this case the shortcode you will use is.

[wpv-post-id item="$current_page"]

Please let me know if this helps.
Thanks,
Shane

#2071769

Many thanks. Your solution worked perfectly.