Skip Navigation

[Resolved] Populate relationship field on grandchild form

This support ticket is created 2 years, 11 months 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 4 replies, has 2 voices.

Last updated by Luo Yang 2 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#2235481

I have a system with nested relationships, and I am trying to show a form for adding grandchildren to a post within a view that is embedded on the content template for the Grandparent post.

Like my other ticket the relationship field is not populating the parent from the view. Maybe I need to pass the value as an attribute, or to put the form on a separate template or page? Really not sure on this one...

This is probably also best addressed by letting you guys have access to the site.

Please enable private reply fields.

#2235733

Hello,

I assume we are talking about this case:
1) Three post types:
- Grandparent
- Parent
- Child
2) Two post type relationships
- One-to-many relationship between "Grandparent" and "Parent"
- One-to-many relationship between "Parent" and "Child"
3) In the single "Grandparent" post, you are going to create new "Child" post

If it is, you can try these:
in the single "Grandparent" post, display a post view:
- Query "Parent" posts
- Filter by relationship between "Grandparent" and "Parent"
https://toolset.com/course-lesson/displaying-related-posts/
- In view's loop, display the form link for creating new "Child" post
See our document:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/

#2236509

I believe you have the overall structure correct.

The issue I have is that I need to grandparent to be displayed after submitting the child post.

One thought I had is with a site had built several years ago that is now gone unfortunately, but someone on here had helped me to build a system where child post forms would popup in a separate window, but I can't find the ticket where they showed me how to do that. There is a related ticket about refreshing the parent window after a child was submitted in another window here:

https://toolset.com/forums/topic/refresh-parent-page-after-adding-child-post-in-new-window/

I think something like this might work for my current project if you can help me get that working again.

#2236577

Alternatively, if I could have a button/link that takes me from the current grandparent post to the children view and lets me loop through them one at a time and then return back to the grandparent post, that would be even better...

#2237939

For the new question:

if I could have a button/link that takes me from the current grandparent post to the children view and lets me loop through them one at a time and then return back to the grandparent post, that would be even better...

How do you setup the option "After visitors submit this form" of post form for creating new child post?

If it is value "Display the post", and redirect to the child post it self, in the single child post, you can display grandparent post information by these:
1) Create a content template, for example "parent-post-info", in the content display the grand parent post link
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-link

2) In the single child post, display above content template shortcode with item attribute:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body