Skip Navigation

[Resolved] Preset parent relationship of child form inside parent's view

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Author
Posts
#672937

Tell us what you are trying to do?
On a parent's list view I added a form on each listed parent item to add a child post. Since the form is shown 'inside' the listed parent item the relationship should be preset. Because of the obvious relationship there is no need to have a select-input. So far I managed to have a correctly preselected select-input with:
[cred_field field='_wpcf_belongs_kurs_id' value='[wpv-post-id id="$kurs"]' max_results='1' readonly='true' required='true']
(readonly and max_results don't have an effect)
I tried to insert a <input type='hidden' name='_wpcf_belongs_kurs_id' value='[wpv-post-id id="$kurs"]'> to pass the needed parent's ID, but the saved (child-)post doesn't apply the relationship.
It would be better to have a fixed parent's ID on the child form, instead of a preselected select-input. Just hiding the select-input makes it too easy to change the relationship with the browser's debugger...

Is there any documentation that you are following?
No.

Is there a similar example that we can see?
Don't know. But the use-case should be obvious.

What is the link to your site?
Doesn't play a role.

#673094

I managed to solve it by myself. Just used the [cred-generic-field] shortcode to generate a hidden input field with the needed name and value.
The idea came from: https://toolset.com/forums/topic/linking-a-custom-post-to-related-user-parent-posts/

The forum ‘Types Community Support’ is closed to new topics and replies.