When creating a new 'CPT A' that is in a 12M or M2M relationship to 'CPT B', users should be able to add related 'CPT B' items from the frontend - preferably while filling out the form for adding a new 'CPT A', and not after submitting the new 'CPT A.
This should also be possible while *editing* an existing 'CPT A' or 'CPT B'.
You cannot have a Form within a Form, so this is not possible like that without a custom code.
But you can redirect, for example.
You can Create the Post with a Form that redirects to a page.
On that page you include a Relationship Form, which in turn may redirect to where the user came from.
That will lead the user to create a Post, Connect it to a existing Page and being redirect to create a new Post again.
(I'm assuming a M2M page/posts)
That can be, if redirected and styled correctly, smooth and even more powerful than having it all in one, as you can apply hooks, and interfere inbetween the single steps.
Hi Beda, thank you for this solution. Just one more question: would it be possible to convert an existing O2M post relationship into a M2M relationship before I set this up, or would that require building the post relationship from scratch again?
P.S. Another 'one more question': would it be possible to link 'Create Post Form' for CPT A to a page that includes 3 different Relationship Forms (to link CPT A to CPT B, C, and D)? Or can a page only include 1 Relationship Form at a time?
1. https://toolset.com/forums/topic/relate-to-other-posts-from-the-create-post-or-edit-post-form/#post-950348
Head to Toolset > Relationships > Edit > and uncheck the warning box.
You will be able to edit certain aspects of the relation, including type.
2. https://toolset.com/forums/topic/relate-to-other-posts-from-the-create-post-or-edit-post-form/#post-950422
A form can be redirected anywhere you want.
A page can hold as many Forms you want, as long they are not within each other.
However, if you pass URL attributes, these are present once, if many forms listen to them, that may produce (expectedly) unexpected situations where all forms are populated with the same values (since you have only one URL)
Hi Beda, many thanks for your kind help. This should get me started in the right direction!