Skip Navigation

[Resolved] parent name was autofilled incorrectly

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.

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

Last updated by antonK-2 1 year, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2609795
4. incorrect - pressed by non-author .png
3. correct - pressed by author of parent post.png
2. cred child form.png
1. link to child cred form from parent post.png

There is a link for child cred form which placed on parent post.

If the link pressed by author of parent post then parent name in the form is autofilled correctly.
If the link pressed by non-author of parent post then parent name in the form is autofilled incorrectly.

field default value for relationship field in child form - [wpv-post-id]

Please help to understand why this happen and how to fix it.

Thank you
Anton

#2609981

Hello,

In the single parent post, you can display the post form for creating new child post, and setup relationship field default value as:
[wpv-post-id item="$current_page"]

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
$current_page is used to retrieve data from the current page being rendered.

#2610075
Снимок экрана 2023-05-25 в 12.26.00.png

I need to have the child post form on a separate page. For this I used instruction
https://toolset.com/course-lesson/front-end-forms-for-editing-content/

create new child post link

Link based on shortcode was created by instruction:

1. Field & Text
2. Add Form
3. Create Child Post Link

as a result I have a link on parent post page.

Link based on shortcode for Create child post link
[cred_child_link_form form='14613' parent_id='-1' text='Превратить Волну в Волшебный Щит' target='_self']

#2610091

You are referring wrong document, please follow our document to setup the child form and form link:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/
When user click the child form link, it will pass parent post ID as URL parameter, so you don't need to setup the relationship field default value

#2610205

it passes parent post ID only in case author of post is logged in user.

Otherwise the filed is empty, parent post ID is not passed.

#2610345

There might be something wrong setting in your website:
The child form shortcode [cred_child_link_form] should display in single parent post

So it will be able to pass parent post ID as URL parameter, if you did not follow our document to setup the child form link, it won't work as expected.

#2610457
6. Page with child form.png
5. Parent page.png
4.png
3.png
2.png
1.png

I follow the instruction exactly. Attaching screenshots step-by-step.

#2610965

Please provide a test site with the same problem, I need a live website to test and debug

#2612839

Thanks for the details,
I assume we are talking about the post form "Volshebnye_volny_form_Волшебники"
hidden link
And I can not find the child form link shortcode in your content template.

So I have tried these in your website:
1) Edit above post form:
hidden link
find and edit field "Волшебные Волны Волшебников", enable option "Get options by any author"

2) Create a new page "Create new child Volshebnye_volny post":
hidden link
Display above post form

3) Edit content template "Волшебник"
hidden link
at the bottom, display the child form link:

[cred_child_link_form form='14810' text='Create new child Volshebnye_volny post' target='_self']

Test it in frontend, for example:
hidden link
click link "Create new child Volshebnye_volny post"
It works fine:
hidden link

Please test again check if it is fixed.

#2613203

My issue is resolved now. Thank you a ton for a solution!