Skip Navigation

[Resolved] Add New Type Form with RGF

This support ticket is created 2 years, 7 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)

This topic contains 17 replies, has 2 voices.

Last updated by michielM 2 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2340555

I'm trying to subscribe Students to certain Workshops that are given at a number of Locations. What I need to know is what Workshop a Student has chosen per Location.

For the Student I have created a Repeatable Group with two Single line fields: Workshop Location and Workshop Name.

I understand that I cannot create new RGF's while adding the Student. So this is what I have come up with for a scenario:

1. Student fills in name and emailaddress;
2. Student clicks Submit to send the form to the server;
3. The server adds the Student and adds as many Workshop Locations to the Student as there are Locations;
4. Then the Student is given an overview of his subscription with a list of all Locations;
5. Each Location has an Edit button next to it, so the Student can fill in the blanks.

Would this work in ToolSet or is there a better way?

The only problem I see in the usage is that the Student might not finish choosing all Locations.

Technically, I would need some help with setting up the Student Template with the View and Edit buttons, but I suppose this documentation would help: https://toolset.com/course-lesson/front-end-forms-for-editing-content/?#adding-an-edit-link-to-a-list-of-items

#2340947

Hello,

For the scenario you mentioned above 1 ~3, it can be done with Toolset plugins, please elaborate more details for 4 and 5:
4. Then the Student is given an overview of his subscription with a list of all Locations;
5. Each Location has an Edit button next to it, so the Student can fill in the blanks.

How do you setup "all Locations"? are you using a custom post type for "Locations"?
Are you going to let students to edit "Locations" posts?

#2340975

Hi Luo Yang,

Locations are created by an admin. Location is a CPT. No, Students cannot edit the CPT Locations; the Students will edit the Repeatable Field called Workshop Location in their own Student type.

Thanks for your help!

#2341045

Thanks for the details, in your case, there does not exists any Repeatable Field item.
And it needs many-to-many relationship, for example, you can try these:
1) Setup many-to-many relationship between "Student" and "Locations"
2) In the overview page, display a post view, query all "Locations"
3) In view's loop, display a relationship form for user to connect "Student" and "Locations" posts:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

#2341305

And then add a field to the Student-Location relation to store the chosen Workshop?

#2341793

Yes, you can add custom fields(Workshop) into the intermediate post type, see our document:
https://toolset.com/course-lesson/many-to-many-post-relationships/
Screenshot:
https://toolset.com/wp-content/uploads/2020/08/add-relationship-fields.png

#2343761

Okay, I will try later this week and let you know how it goes.

#2344279

I have marked this thread as "Waiting for feedback" status, please update here if you still need assistance for it, thanks

#2346829

As I'm setting up the new relation, my eye caught something you wrote earlier. I wrote:

"3. The server adds the Student and adds as many Workshop Locations to the Student as there are Locations;"

And you replied:

"For the scenario you mentioned above 1 ~3, it can be done with Toolset plugins [...]"

I was under the impression that I would have to write a php function to add these Workshop Locations. Could you please tell me how I would add these relations with ToolSet pluging?

#2346835

You wrote:


1) Setup many-to-many relationship between "Student" and "Locations"
2) In the overview page, display a post view, query all "Locations"
3) In view's loop, display a relationship form for user to connect "Student" and "Locations" posts:
https://toolset.com/course-lesson/front-end-relationship-forms-for-connecting-posts/

In 2) you write about making a view, but in the documentation it says create a Relationship Form. I'm confused. Which is it or is one in the other?

Thanks for your help!

#2348445

Yes, the document is for step 3): In view's loop, display a relationship form for user to connect "Student" and "Locations" posts.

Since my suggestion is using many-to-many relationship, it needs to use relationship form to connect the "Student" and "Locations" posts.

For your reference.

#2349541

Ah, now I see how to connect two types with a Relationship Form. So I can now make my question a bit more specific:

As I wrote earlier:

1. Student fills in name and emailaddress;
2. Student clicks Submit to send the form to the server;
3. The server adds the Student and adds as many Workshop Locations to the Student as there are Locations;
4. Then the Student is given an overview of his subscription with a list of all Locations;
5. Each Location has an Edit button next to it, so the Student can fill in the blanks.

In step two the relation between Student and Location has already been made. I need a form where both Student and Location are already known (as I am on the page about the Student and the connected Locations are shown with a View), but the Relationship field (Workshop to attend at that Location) still has to be determined.

Maybe it is easier for you to log in to my site and have a look as Shane has done before?

#2349543

(Oh, and also: please have a look at my question of April 22, 2022 at 10:14 am, #2346835)

#2350407

For the step 3) The server adds the Student and adds as many Workshop Locations to the Student as there are Locations;
Toolset won't connect posts automatically, in this step, you can setup a post view:
- query all Locations posts,
- in view's loop, display the relationship for user to connect his foveate "Locations" post

See my above answer:
https://toolset.com/forums/topic/add-new-type-form-with-rgf/#post-2341045

If you still need assistance for it, please provide a test site with the same problem, I can setup a demo in it.

#2352395

I understand your answer, but it's not what I want.

Every Students needs to select a Workshop per Location. The Student does not choose a (favourite) Location.

I can give you a login to my site for you to check out. It's still in development, so you can treat it as a demo site.