I have a one to many relationship for post types, members and documents. I created a post form for documents and included a relationship field for members. When I visit the form on the frontend, I can only select one member to assign to a document. However, when I edit the form via the Dashboard backend, I can select multiple members to assign to a document.
I need to be able to select multiple members on the frontend. I am using the following shortcode. Please advise.
[credform]
[cred_field field='form_messages' class='alert alert-warning']
<div class="form-group">
<label>Document Title</label>
[cred_field field='post_title' class='form-control' output='bootstrap']
</div>
<div class="form-group">
<label>Folders</label>
[cred_field field='folder' force_type='taxonomy' output='bootstrap' display='checkbox']
[cred_field field="folder_add_new" taxonomy="folder" type="add_new"]
</div>
<div class="form-group">
<label>Document Upload</label>
[cred_field field='document-upload' force_type='field' class='form-control' output='bootstrap']
</div>
<div class="form-group">
<label>Assigned Members</label>
[cred_field field='@member-document.parent' class='form-control' output='bootstrap' select_text='--- not set ---']
</div>
[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]
Hello,
The question is not clear.
I assume we are talking about one-to-many relationship between post types "members" and "documents".
If it is, one "documents" post can connect to only one "members" post, so you can not connect multiple members with a "documents" post.
See our document:
https://toolset.com/documentation/post-relationships/
If you need to setup:
- one "members" post can connect to multiple "documents" posts
- one "documents" post can connect to multiple "members" posts
Then it needs many-to-many relationship.
But Toolset post form does not support many-to-many relationship yet, you can setup relationship form to connect existed posts with others, see our document:
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/
Hi. Thanks for the response. The tutorial on how to create a relationship form was helpful. However, I need to be able to select multiple entries for one of my CPTs in the relationship CRED form. Please visit the following Toolset inquiry at https://toolset.com/forums/topic/creating-a-multi-select-relationship-dropdown/
This is exactly what I need. I can already select multiple entries on the backend to add to my relational CPT, but we need it to be done on the frontend. Please advise. 🙂 Eric
Yes, you are right, there isn't such a built-in feature within Toolset forms:
One relationship form can connect one post with only another one post at the same time.
You can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our developers will evaluate it.
Thank you, Luo. OK. One more thing that I need to do. If you visit hidden link you will see that I have two many-to-many relationships: Documents to Folders, and Members to Folders.
I assigned our users to their respective member post type. For example, I created a Member titled Eric Reynolds, and I made me, Eric Reynolds, the author of the Member post. Now, when a member logs into the site, I need her or him to be redirected to a view that only displays the documents of the folders that the members belong to. They will not be able to see any documents of folders that they are not in a relationship. Is that possible?
Also, is it possible to add users as authors to Members posts on the frontend?
Thank you!
🙂 Eric