Tell us what you are trying to do?
I have created a CPT called dog breeds. Now the next step is to create another CPT called dogs.
Then I will create a one-to-many relationship (a dog can only be one breed but a breed can have many dogs).
Would it be possible to add a drop down list to show the CPT breed list in the frontend form?
Is there any documentation that you are following?
No
Hello. Thank you for contacting the Toolset support.
When you have one-to-many post relationship and if you create a frontend form for the child post type, then if will offer you the parent field as dropdown so that you can connect the child item you are creating with your desired parent.
I followed the instructions and I think I have succeeded.
But in the drop-down list only some elements are shown and not all of them, Is there a possibility to show all the elements in the drop-down list?
I would like to know if I am doing things right, so I have another question. When the user adds a dog through the frontend form, the data is stored in the dogs CPT, but what about the breed field that is selected from another CPT through a drop-down?
Do I need to add another field inside the CPT dogs to be able to store the value of the CPT breed that is selected from the drop-down list?
When you select the parent post in your child form - the parent post should be automatically connected when you edit your edit child post in backend under the post-relationship box.
You can follow any of the course we offer that will help you to understand how all these features works:
- https://toolset.com/course/
Well - the parent field is a select2 field so only limited options are displayed by default. For more option you should try to search in the text box and it will offer you the found options.
If you do not want to use that, then you can switch to "Expert Mode" and to the parent field what if you try to add the attribute use_select2="never":
Works only on sites not using the new post relationships (legacy code). If used with new post relationships (Types 3,0+), it breaks the "order", "ordering" and "author" attributes. It can also break background checks like what post type to display in the select field for relationships. Warning: Do not use this attribute if not explicitly required.
So, as per the Doc when you use this attribute use_select2="never" it will affect the ordering: