Skip Navigation

[Resolved] Create child post link using expert mode

This support ticket is created 3 years, 6 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.

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 5 replies, has 3 voices.

Last updated by Luo Yang 3 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#2150931

Dear Sir/Madam,

I refer to page https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/#creating-forms-when-a-parent-post-is-preselected, I follow the steps but I can't find the pop-up dialog and Create Child Post Link. May I know whether it is do from block editor or classic, do you have the shortcode about this I can add in classic ?

#2151547

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2021-08-25 at 15.43.40.png
Screenshot 2021-08-25 at 15.43.32.png

You have a form to publish child posts, and that form includes a parent post selector.

You add that form to a page.

You edit the Content Template for the parent post type where you want to insert a link to the form to create a child post.

You need to insert a Fields and Text block (or a Classic block) to be able to access the Toolset Forms button (screenshot).

Once you click to add a form, the resulting dialog (screenshot) includes a Create Child Post Link button.

You then specify the name of the page containing the form, and be sure to select the option "Set the parent according to the currently displayed content".

I think that is everything required, can you please try the above?

Thank you.

#2151909
Screenshot 2021-08-26 at 4.57.33 AM.png

Dear Nigel,

Thanks for your prompted reply. I find the block editor doesn't work friendly as I familiar with the expert mode. Could you please advise how I can auto select the parent field by passing url parameter as I don't want user to select the parent post that not created by him.

Refer to screenshot and below code

	<div class="form-group">
		<label for="%%FORM_ID%%_@application-contestant.parent">[cred_i18n name='@application-contestant.parent-label']Applications Contestants[/cred_i18n]</label>
		[cred_field field='@application-contestant.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='true']
	</div>
	[cred_field field='form_messages' class='alert alert-warning']
	<div class="form-group">
		<label for="%%FORM_ID%%_contestant-mode">[cred_i18n name='contestant-mode-label']參賽形式[/cred_i18n]</label>
		[cred_field field='contestant-mode' force_type='field' class='form-control' output='bootstrap']
	</div>

I want the field='@application-contestant.parent' be auto-selected by passing url-parameter (parent post id)

I want the field='contestant-mode' be auto changed according to custom field from parent post, I can write custom code to get the custom field if I have the parent post id

#2152193

Dear Nigel,

I want the field='@application-contestant.parent' be auto-selected by passing url-parameter (parent post id)

I wrongly put the url-parameter, it should be parent_slug-of-parent-post_id.

I want the field='contestant-mode' be auto changed according to custom field from parent post, I can write custom code to get the custom field if I have the parent post id

I still cannot solve it as don't know whether the jQuery or shortcode can do, please advise.

#2152825

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You shouldn't need to make any specific changes to the form.

In my test site, switching the form to Expert mode I can see that the parent select input is inserted like so, with no special parameters to specify how it should be pre-selected:

[cred_field field='@post-thing.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false']

The parent input gets pre-selected because of how you add a link to the form, using the cred_child_link_form shortcode, inserted as I described above.

Again, the example from my test site is like so:

[cred_child_link_form form='108' parent_id='-1' text='Create new child Thing' target='_self']

The parent_id='-1' attribute is what is responsible for setting the default on the form parent input.

#2153281

Please let me know if you need more assistance for it, thanks