Skip Navigation

[Resolved] Help & Best practice for Event registration Form

This thread is resolved. Here is a description of the problem and solution.

Problem:

Setup post form for creating child post, and display parent post information.

Solution:

you can follow below document to setup it:

Relevant Documentation:

https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

100% of people find this useful.

This support ticket is created 6 years, 4 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Author
Posts
#1128276

Tell us what you are trying to do?
It is my Goal to create a Registration Form for a Custom Post Type.

So, I want the User to be able to Register to a specific Event, therefore I created two Custom Post Types. "Event" & "Event Registrations". I created the custom fields for the "Events" and displayed it in an Elementor Pro Templated. It worked great!

Now I tried to add a form that allows Users to register to that specific event. Therefore I added a relationship between "Events" & "Event Registration", one(Event) to many(Event Registration). Then creating the Form(in Event Registration) I am not able by any means to add a connection or fields from the related Post Type. The "Event Registration"

Next, I tried to do add parent field values to the form, so I could use the form and just collect the values of the "Event". But in the end, neither worked for me.

I think I'm going wrong about this, can you help me? Is there a better way to do this or a use-Case I can follow?

Is there any documentation that you are following?
Yes, your site documentation was great, but I can't figure this one out.

Is there a similar example that we can see?
You have an Example on your website that is somewhat similar:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

#1128836

Hi,

Yes, you are following the correct document:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

Are you going to display a post information(custom fields) in the post form for creating child post?

According to above document, when you click the link(Forms child form link via the Toolset Forms button), it will pass an URL parameter to target page, for example "parent_[relationship-slug]_id=123", the number 123 is the parent "event" post ID, you can display it with Views shortcode:
[wpv-search-term param="parent_[relationship-slug]_id"]
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-search-term

Pass it to Views or Types shortcode, and display the "Event" post information, for example:
[types field='student-id' item='[wpv-search-term param="parent_[relationship-slug]_id"]'][/types]

#1128866

I first thought i found a solution but it seems the problem is on another part of the question

#1128869

Sorry. but I think I may have led you the wrong way. The selection of a parent post is now clear to me. And when I connect an "Event" with an "Event Registration" in the backend(Manually) I am able to display it together, thanks to your explanation.

BUT the question was about how to create a Form that creates a post from "Event Registration" and automatically has a relationship between "Event" and "Event" Registration". So far I need to do it by going into the custom post type and adding the specific Relation to a Post from "Events".

How do I add that connection to a standard form?

#1128926

Yes, it is possible to setup the post relationship automatically, see the document you mentioned above:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected

section "Creating forms when a parent post is preselected"

If you are displaying the post form in single "event" post, you can also setup the default value in the relationship field as current event post ID, for example, you can get current event post ID with shortcode [wpv-post-id]
use it as attribute of form shortcode, for example:
[cred_field field="@RELATIONSHIP-SLUG.parent" class="form-control" output="bootstrap" select_text="--- Choose a event ---" readonly='false' value="[wpv-post-id]"]

Then you can use CSS codes to hide the relationship field.

More help:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
value. Optional. Preset value

#1128950

Yes! That's it. It works!

Thank you for your patience with me, it took me longer then I thought to understand the shortcode subject.