Hi,
I've a relationship between:
- "Accommodation" post type
- "Quote" post type
I've created a form to add a new post type "Quote"
This form is displayed in an "Accommodation" post type
When this form is submitted should be direclty update a relationship between the "accommodation" where the post is displyed and the new "Quote" post type created with the form.
Hello,
I suggest you setup one-to-many relationship between those post types:
- "Accommodation" post type
- "Quote" post type
Then you will be able to create a post form for creating "Quote" post, it will be able to related the new "Quote" post with specific "Accommodation" post, see our document:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/
Section "Creating forms when a parent post is preselected"
Hi Luo, is not what I'me searching for.
I've just create a post to add a new "quote" post type and i've also just created a relationship one-to-many.
What I need is to does not choose the "Accommodation" post type to associate to the "Quote post type" but assingn it automatically.
The form to add a new "Quote" is displayed in the "Accommodation" post will be related.
So how to set automatically a relation between the new post I'm creating the the second post where i displayed?
If you share me private messagge I shoe you the link, could be more clear.
OK, I have enabled the private message box, please provide the your website credentials and the links, thanks
Thanks for the detail, you just need to setup the default value of relationship field as current "accommodation" post ID, for example, modify the shortcode from:
[cred_field field="@preventivo-struttura.parent" class="form-control" output="bootstrap" select_text="--- non impostato ---" readonly='false']
To:
[cred_field field="@preventivo-struttura.parent" class="form-control" output="bootstrap" select_text="--- non impostato ---" readonly='false' value="[wpv-post-id]"]
Then test again, and you can use CSS codes to hide the relationship field.
More help:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
value. Optional. Preset value
My issue is resolved now. Thank you!