Skip Navigation

[Resolved] Display fields of parent for Repeatable field group in edit form and notification

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

Problem: I have an Edit Form used to edit a row of some RFG attached to my custom post type. I would like to display information from the parent custom post in the Form edit page, and I would also like to include information from the parent post in the email notification.

Solution: In the Form display section, use the wpv-search-term parameter to access the parent post ID. Then in the email notification, use the @relationship-slug.parent syntax.
In the Form page:

[types field="task" item="[wpv-search-term param='someparameter']"][/types]

In the notification:

[types field="email" item="@delegate-group.parent"][/types]

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/
https://toolset.com/documentation/getting-started-with-toolset/publish-content-from-the-front-end/forms-for-editing/
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/front-end-forms-for-repeatable-field-groups/

This support ticket is created 5 years, 7 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1278455

Hi
I am trying to display fields of the parent of related to a rpg form
I have used this
[types field='task' item='$parent'][/types]
But nothing displays

Tony

 

<a href="<em><u>hidden link</u></em>;">Back to Delegate List</a>
[types field='task' item='$parent'][/types]

[credform]
	[cred_field field='form_messages' class='alert alert-warning']

	<div class="form-group">
		<label>First Name</label>
		[cred_field field='first-name' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Last Name</label>
		[cred_field field='last-name' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Delegate Email</label>
		[cred_field field='delegate-email' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Attended</label>
		[cred_field field='attended' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group hidden">
		<label>Planner Event</label>
		[cred_field field='@delegate-group.parent' class='form-control' output='bootstrap' select_text='--- not set ---']
	</div>
	[cred_field field='form_submit' output='bootstrap' value='Update' class='btn btn-primary btn-lg']
[/credform]

 
#1278627

If the parent post ID is passed to this page using a URL parameter, you could use wpv-search-term to get that ID for the item attribute:

[types field="task" item="[wpv-search-term param='someparameter']"][/types]

Change someparameter to match your URL parameter name.

#1279011
editdelegateform.JPG

Hi
I have added the URL parameter
I can see the parent field info on the top of my form, which is great
hidden link;">Back to Delegate List
<div>[types field="email" item="[wpv-search-term param='wpv-relationship-filter']"][/types]</div>
<div>[types field="employee" item="[wpv-search-term param='wpv-relationship-filter']"][/types]</div>
<div>[types field="stdstartdate" item="[wpv-search-term param='wpv-relationship-filter']"][/types]</div>
[credform]
[cred_field field='form_messages' class='alert alert-warning']

What I am then doing in triggering an email when the attended flag is changed ticked is to trigger an email.
Email gets sent, but if i paste the above field in the email content and subject. The email does not show any values.

#1279033

In an email notification triggered by the child post form, use the @relationship-slug.parent syntax like this to output the parent field information:

[types field="email" item="@delegate-group.parent"][/types]
#1279123

My issue is resolved now. Thank you!

#1279595

Sorry about this how do I get the post title of the parent ?

#1280337

In the notification, use the wpv-post-title shortcode with the @relationship-slug.parent syntax.

[wpv-post-title item="@delegate-group.parent"]

When displaying the Form, use the wpv-post-title shortcode with the wpv-search-term shortcode.