Skip Navigation

[Resolved] automatically link a form to a CPT

This support ticket is created 4 years 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 2 voices.

Last updated by fabriceS 4 years ago.

Assisted by: Shane.

Author
Posts
#1842273

I've created a CPT "Properties"
I have also created a CPT "Information request" with a 1 to many relationship " Property-InfomationRequests".
In the content template to view a property I included a "Information Request" form for the visitors.

I would like the "InformationRequest" form content filled by the visitor to be linked automatically to the property from which I filled in.

How to do that ?

There is a way to add the relationship of the form to a property inside the form design, but it Is asking the visitor to choose. I'd like it to be done automatically without asking the user because then the risk it for him to chose another property...

Can you help me please ?

Thanks a lot.

Fabrice

#1842577

Shane
Supporter

Languages: English (English )

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

Hi Fabrice,

Thank you for getting in touch.

I believe this document below covers exactly what you are trying to achieve.
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/#creating-forms-when-a-parent-post-is-preselected

Please let me know if this helps.

Thanks,
Shane

#1842633

Well... yes and no...
actually I'm developping a real estate website and on the page of each properties I want to display a simple form where the user will fill his name, phone and email and a message box to ask questions about THIS porperty. and so I need the connection between the form content and ThIS property.

The form is inside the content template for my properties. I don't want to go to another page to fill the form.

What I see in the form is the possibility for the user to choose any property to "link it" but I don't want him to choose because he is filling it on the property page.

#1843601

Shane
Supporter

Languages: English (English )

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

Screenshot 2020-11-13 at 10.30.50 AM.png

Hi Fabrice,

In a case like this you will need to set the default value for the relationship field on the form to [wpv-post-id] See Screenshot

Once you've done this it should auto select the current post as the parent of the form.

Please let me know if this helps.
Thanks,
Shane

#1843799

My issue is resolved now. Thank you!