Skip Navigation

[Resolved] Select-Box with event-number and event-name

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.

Our next available supporter will start replying to tickets in about 0.87 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 5 replies, has 2 voices.

Last updated by Nigel 6 years, 4 months ago.

Assisted by: Nigel.

Author
Posts
#953611
Selectbox.png

Hi Nigel,

hope, you had a nice vacation?! 🙂
In reference to this thread https://toolset.com/forums/topic/split-custom-display-in-forms/, I gone through the forms-training-course last week. It was a good overview about what is possible with the 2 kinds of forms in Toolset. 🙂
Now for the post-form (Register-Form for the front-end user to register for an event) the customer wants, that the front-end-user can choose from a select-box the event (like you see in the screenshot attached). The problem is, that the select-box contains the event-number and event-name. So how can I achieve, that the team stuff in the backend enters the event-name and event-number and the fron-end user sees the select-box with the values from the backend (like in the screenshot)?
Thanks
Thorsten

#953715

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I'm not sure I understand, Thorsten.

Your form is to register an event, but there should be a dropdown listing events?

What you describe sounds to me as if you have an events post type, and that your form is intended to publish posts that are child posts of events, so that the select dropdown allows the user to choose which event their submission belongs to.

So the select dropdown would be populated with a list of parent event posts.

Normally these display only the post title (the name of the event), but you want to display an event number as well?

Where does this number come from? Is it a custom field value on the parent event post?

Can you please clarify?

#953727
Custom_Post_Types.png
Custom_Post_Type_Events.png

I created two Custom Post Tyes. One is the event, with event details, event image etc. (see https://toolset.com/forums/topic/display-a-view-or-template/#post-918798). But for better understanding, i made some screenshots. Maybe it is more clear:

The first Custom Post Type is events ("Veranstaltungen"): There the team member can put in the data for a single event, that it looks similar to their old site (maybe you can remember to the traffic-light-system? -> hidden link -> click on a single event -> hidden link) This single event from the old site (hidden link) is the Custom Post Type "Veranstaltungen" on the new site and also the view with the traffic light system on the new site (hidden link). If you click on the event "Testveranstaltung" you can see what it looks like at the moment (hidden link). Below the event-description there should be the register-form. Right now there is a register-form I created with Toolset post-forms. The first name (Vorname) etc. is also from the Custom Post Type "Veranstaltung". But I think it's better to seperate the register-form from the event Custom Post Type. Therefore I create a second Custom Post Type register-forms (Anmeldeformulare) where those fields should be in like first name, last name (all that you can see in the "Testveranstaltung"). But there should also be a dropdown menu in the form like you see in my first post attachment, which is from their old PDF. This dropdown should contain the event number (a 4-digit number and the event name), so if the user submits the dorm, the team member should see the event number and event name in a Mail.
The team member has to create all the event numbers as well as the event names in a Custom Post Type (I thought to use a second Custom Post Type "Anmeldeformulare" for this) so that the event names and numbers are in a dropdown. I don't know, if it is possible to realize this? Do you have a solution for this?

#954417

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I looked at your site to familiarise myself again with your set up.

There is some confusion because you have the events post type (Veranstaltungen), you have a repeating field group added to that post type for registrations (Anmeldungformular), and you have a second custom post type for registrations (Anmeldeformulare).

The template for displaying events includes a form (veranstaltungsformular_neu) and that form is for adding the repeatable field groups (Anmeldungformular) to your events.

(I see that there is another form—Anmeldeformular—for the Anmeldeformulare post type which doesn't appear to be used.)

Now, the implementation of repeatable field groups is quite similar to one-to-many post relationships. Logically your Veranstaltungen post type would be connected to your Anmeldeformulare post type in a parent-child relationship, but you haven't created any such relationship, so there is currently nothing to connect Anmeldeformulare posts to Veranstaltungen posts.

I assume you decided to go with the repeating field groups solution.

In either case your form would need to include a parent selector field (which is added if you automatically generate the form).

Your veranstaltungsformular_neu form has such a field.

As you will have seen, this lists only the parent post titles (i.e. the event titles).

There are no options to customise this, so it is not possible to output some other field value (e.g. an event number) before the title.

The only way to do that would be to save the event posts with the number in the title in the format you require (which would obviously then affect how your event titles appear elsewhere).

There isn't much more to add, the format of the title of the parent in the select dropdown cannot be modified.

#954429

Hi Nigel,

ok, thanks to take a look onto the website.
Though I did read a lot of documentation about the Toolset Suite and did take the forms training course as well as the beginners training course, Toolset has a very steep learning courve, but it is very powerful and thanks to you and your colleagues you have great support.
Maybe I did something wrong with the configuration. Which is in your opionion the best way to achieve the dropdown menu in the form? To go with the relationship ( I assume one-to-one) or only make one CPT (Veranstaltungen) and go with the repeatable field groups? Sorry, that I don't understand the concept to get the form under the event description with the dropdown box. How do I have to implement the dropdown box with the values? Isn't it a way that I create two additional custom fields (one for the event numeber and one for the event name) and the team member enters all events (with their number, description, name etc.) and the values (number and event name) from all events can be collected in the dropdown box?

#955436

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Thorsten

Under the hood the implementation of repeatable field groups is very similar to a one-to-many relationship, and it doesn't really matter which option you decide to go with.

If you were to use a post relationship between two post types it would be a one-to-many relationship (one event can have many registrations), commonly described as a parent-child relationship.

As soon as you create such a relationship then when you make a form to publish the child posts (the registrations), if you auto-generate the form then the field which specifies to which parent this child belongs will be automatically added.

As stated above, there are no options to customise what is displayed in this field, however. It will display the post titles of the parents (i.e. the titles of the events), and this is the same whether you use post relationships or repeatable field groups (where you need an equivalent field that specifies which post (event) these repeatable fields belong to.

Now, the typical workflow would be that you have a template to display an event, and that template either includes a link to add a child post (which would automatically set the parent select field in the child post form), or includes the form itself. In that case, you can automatically set the correct parent event (the one currently being displayed) by editing the child post form and adding the following attribute to the parent post selector field:

value='[wpv-post-id]'