Skip Navigation

[Resolved] Setting up a relational post form

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

Problem:

Setup relationship form using many-to-many relationship.

Solution:

Here are detail steps:

https://toolset.com/forums/topic/setting-up-a-relational-post-form/#post-1154440

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/

This support ticket is created 6 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 – 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 6 replies, has 2 voices.

Last updated by AndreG3332 6 years ago.

Assisted by: Luo Yang.

Author
Posts
#1152613

This post is in relation to a previous support post. https://toolset.com/forums/topic/auto-population-of-table/
Christian was assisting me but the post has already been closed.

with reference to the previous post, I am having a challenge with the point three on this reply https://toolset.com/forums/topic/auto-population-of-table/#post-1141491

I believe there may be a bit of miscommunication here. I have already followed the instruction to the point of the custom field for the required year. I am at a loss for setting the "and add a checkboxes group field that represents each User Level" Is this field linked to the user field created or is it just a simple checkbox?

At this stage, I am unable to establish the required documents for a year for the client.

I have so far created:
the Customer Cpt
The Customer Classification Cpt
The document master list CPT
The submissions CPT
and the Requirements CPT

The following relationships have been created:

Customer to Customer Classification "Many to one"
Customer to Requirement " One to may"
Requirements to submissions "One to many"

My current issue is with the cred form front end to set up the requirements. I am stuck as to how to do it.

The next point is when I set up the submission and requirements many to many relationships What would be the "relationship fields" or is that left blank?

Thx

#1152907

Hello,

Q1) add a checkboxes group field that represents each User Level
As I understand, there should be a custom checkboxes user field: "User Level", so it means you can setup a custom chexkboxes post field "User Level", and register it to post type "Requirements"

Q2) My current issue is with the cred form front end to set up the requirements.
I assume you are going to create a Toolset form for creating/Editing "Requirements" post, in this form display a parent "Customer" selector, if it is, please check our document to setup this form:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

Q3) The next point is when I set up the submission and requirements many to many relationships What would be the "relationship fields" or is that left blank?
Toolset post form does not support many-to-many relationship yet, it is in the feature request, you can add your vote on it here:
https://toolset.com/feature-request/?wpv_post_search=Extend+current+Post+Forms+to+allow+Many+To+Many+Connections&wpv-wpcf-plugins=Forms&wpv_view_count=686737

Currently, you will try the relationship form to connect existed posts, see our document:
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/

For your reference.

#1153739

thx for your reply. With respect but regarding Q3 Toolset does support many to many relationships. refer your own documentation:

https://toolset.com/documentation/post-relationships/

#1153742

Yes, Toolset supports many to many relationships on the wordpress admin side with Types plugin, but Toolset form plugin does not support it in wordpress front-end directly, see my answer above, it is still in feature request list:
https://toolset.com/feature-request/extend-current-post-forms-to-allow-many-to-many-connections/

So we have provided the relationship form:
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/

#1153752

Thx for your reply.

Then I am at a loss right now as how to proceed with this any further. I would need some assistance, please.

What I am trying to achieve is to set up a document tracking system.

A company has to submit a series of documents to achieve a certain level of "achievement".
There are three levels that will determine a which of a specific set of documents that has to be submitted.
Once the company has submitted the documents it will be manually assessed and approved or declined by an assessor

Once approved it will be marked as completed and once all documents for the year has been marked as completed it should be closed.
This is an annual process and will be done every year.

Sofar:
I have a Customers CPT with a child for the contact people from that company
I have a Categories CPT with the three categories and description.
I have a Master document list CPT with the documents lister per category
I have a Requirement CPT - this is where my problem is starting.
I have a submission CPT - where the required documents will be uploaded for assessment.

I now need to create a front-end input where the consultant will "OPEN" a new year, link it to a Customer, and on the basis of the categories the customer falls under, populate a list from the document master list for the documents to be submitted. right now I have managed to do it only where you have to link the documents one by one to the customer for a particular year.

This is what the basic form looks like at the moment. However, the approach of individual links is way to cumbersome.
hidden link

If you could assist me with a guideline how to achieve this please.

Now this is at this stage that the many to many relationships would come to play because each document in the document master list can belong to more that one category and each category use some or all of the documents on the master list

#1154440
relationship-form.JPG
relationship-form2.JPG

I assume you have setup many-to-many relationships between post type "submission" and "requirements", and you are going to connect each "submission" post with multiple "requirements" posts in front-end with Toolset form plugin.

If it is, you can try these:

1) Setup many-to-many relationship between post type "submission" and "requirements", for example the relationship slug is "submission-requirement"

2) Setup some posts in post type "submission" and "requirements", leave the posts relationship empty, this is required, since the relationship form works only for existed posts, within Toolset post form, you can not setup the relationship directly when create/edit a "submission" post. In this case, we need to use relationship form to setup the many-to-many relationship "submission-requirement".

3) Dashboard-> Toolset-> Relationship Forms Editor,
Create a relationship form with Toolset form plugin, for example "Setting up a relational post form", see screenshot relationship-form.JPG, you will need to customize it according to your own website settings.

4) In a single "submission" post, show above relationship form for assessor(or some specific) users
for example:

[cred-relationship-form form='setting-up-a-relational-post-form' parent_item='$current']

See screenshot relationship-form2.JPG

Test a single "submission" post in front-end, you should be able to see the relationship form "Setting up a relational post form", with it assessor(or some specific) users can connect this document post to multiple "requirements" posts

5) And In a single "submission" post, you can create a post view, query "requirements" posts, filter by the relationship "submission-requirement", and display the "requirements" post information.

More help:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

Hope it is clear.

#1155420

My issue is resolved now. Thank you!