Skip Navigation

[Resolved] Split: The automatic attachment to the post does not work – maximum allowed amount association

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to auto fill the parent field with current post ID with Toolset forms

Solution:
You should use value attribute and assign it the current post ID using shortcode [wpv-post-id] in order to auto select the current post ID from parent dropdown select.

For example:

<div class="hide_parent">
[cred_field field='@dom-otzyvy.parent' select_text='--- not set ---' value="[wpv-post-id]" class='form-control' output='bootstrap']
</div>

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/split-the-automatic-attachment-to-the-post-does-not-work-maximum-allowed-amount-association/#post-1083074

Relevant Documentation:

This support ticket is created 6 years, 3 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Serhii 6 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#1081406

It doesn't work, i see this error - hidden link

But I care about another. Yours implementation is very difficult. I believed that this could be done without using php, hooks etc =(

I read this article https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected

There is no mention of use php/hooks (part "Creating forms when a parent post is preselected"). Perhaps there is an easier way?

=======

Is not it logical, when a user wants to leave a review for the object, so that review immediately became attached to this object?

#1081410

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As you shared the screenshot: => hidden link

While creating post relationship - did you set any limit to create post?
==> And Yes - I see you have set the limit.

Please check following screenshot:
=> hidden link

In Toolset > Relationships > Edit your post relationship - as you can see with above screenshot you set to have only 2 post under the Limit section. Please change the limit value or disconnect the already connected poss if you want to still use the 2 posts for relationship and save your post type and it should be fine.

#1082824

Ok, about limits I understand.

==============

But my main problem is automatic connection review to an object (In my demosite "object" is meant house for rent).

Ok, one more time.

I have this object hidden link - this is house for rent.

Some user rented this house some time ago. And wants to leave a review.

User opened this page with a description of the house (hidden link) and saw review form. The user fills in the form fields.

Since the user is already on the page of this rented house (hidden link) he logically suggests that his review automatically becomes attached to this house.

--->>> And I want to implement this logic <<<---

But at the moment, I'm only getting this way - hidden link
(drop-down list with all houses, instead of automatically linking to a particular house)

==============

You proposed a solution using php and hooks. But this is a difficult way for me. If possible, I would not want to use API, edit file functions.php, use hooks etc.

==============

I want to know there is a way to implement what I want to use basic functional Toolset (without api, php ,hooks)?

And as an example, I gave a link to an article https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected

Since it seemed to me that there was realized something similar to what I need (but it is not exactly).

==============

But how to implement it with the help of the basic functionality Toolset (without api, php ,hooks) I do not understand. If this is possible, please tell me how.

#1083074

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok - as you do not want to go with API way - I removed the code from your current theme's functions.php file.

I've added following code to your form and assign the current post ID as you wanted based on the link you shared:
=> https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

<div class="hide_parent">
[cred_field field='@dom-otzyvy.parent' select_text='--- not set ---' value="[wpv-post-id]" class='form-control' output='bootstrap']
</div>

I've added following line of CSS to your forms CSS box:

.hide_parent { display: none; }

I can see its working - I just gave you option that you can even use API and Generic field as well so you do not need hide the filed using CSS.

But as per your requirement I've adjusted code and I can see its working.

Please do not forget to adjust the LIMIT for your post relationship as I can see its still set to only 2 post under the Limit section of post relationship

In Toolset > Relationships > Edit your post relationship - as you can see with above screenshot you set to have only 2 post under the Limit section. Please change the limit value or disconnect the already connected poss if you want to still use the 2 posts for relationship and save your post type and it should be fine.

Please close both tickets now 🙂

#1083679

Thanks a lot, so the solution of my problem was adding =)

value="[wpv-post-id]"

.