Skip Navigation

[Resolved] repeating group in form

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

Problem:

Setup image caption of repeating image field with Toolset post form.

Solution:

In the form for creating post, you can enable option "Use the WordPress Media Library manager for image, video, audio, or file fields".

When user upload an image, he can upload multiple images in the same image field, and setup the image attributes, including "capiton".

Relevant Documentation:

https://toolset.com/documentation/user-guides/front-end-forms/using-the-native-wordpress-media-manager-in-front-end-forms/

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.

This topic contains 9 replies, has 2 voices.

Last updated by martinB-16 1 month ago.

Assigned support staff: Luo Yang.

Author
Posts
#1679705

I would like to be able to add several images, each with its own capiton, using a form.
I assumed that I could use custom fields from a repeating group.
However, this repeat group is not offered to me in the form administration.
How can I include a repeat group in a form?

#1680169

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

Toolset repeatable field group is based on one-to-many relationship, each item of repeatable field group is also a single post, so you will need to follow our document to setup another form for user to add new item in repeatable field groups:
https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/

According to W3C document, you can not embed one HTML form(child post form) into another HTML form(parent post form), see similar thread:
https://stackoverflow.com/questions/379610/can-you-nest-html-forms

And in your case, it needs only a custom multiple-instances image field, in the form for creating post, you can enable option "Use the WordPress Media Library manager for image, video, audio, or file fields", see our document:
https://toolset.com/documentation/user-guides/front-end-forms/using-the-native-wordpress-media-manager-in-front-end-forms/
When user upload an image, he canupload multiple images in the same image field, and setup the image attributes, including "capiton", see screenshot Caption.JPG.

#1681165

thank you
The "detour" in toolset galleries via the Media Library works.
But with a toolset image there is unfortunately no option to use the label from the media library.
So the user has to use two different ways.
Or can the labeling also be used with toolset Image?

#1681385

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Please elaborate the new questions with more details?
What is the "labeling" you mentioned above? how do you setup it?
And where and how do you want to display it?

#1681873

How can I use the caption from the WP media library for the block toolset-image?

#1681969

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

The Toolset Gallery block will display image caption text at the bottom of each image, see screenshot captions.JPG
More help:
https://toolset.com/course-lesson/dynamic-galleries-and-sliders-for-templates-displaying-repeating-image-fields/

And you can also follow our document to display the image attributes(caption, title, alt) with Types shortcode, see our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#image
For the alt and title attributes, you can also use placeholders to output the values of standard image fields added in WordPress: %%TITLE%%, %%ALT%%, %%CAPTION %%, and %%DESCRIPTION%%.

#1682751

This is not the answer to my last question. This was:

How can I use the caption from the WP media library for the block toolset-image?

#1682917

In the gallery there is the option to display captions from the media item.
There is no such thing with an image.

#1683391

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the detail, you are displaying post featured image with a Toolset image block, this block can not display image caption attribute directly, but you can use a shortcode to display the image caption:

[tb-caption url="[wpv-post-featured-image size="full" raw="true"]"]

For example, edit the Toolset image block you mentioned in screenshot:
https://toolset.com/wp-content/uploads/2020/06/1682917-exampel.jpg

Find the text "Write a caption", fill above shortcodes, then test again.

More help:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-featured-image

#1684237

My issue is resolved now. Thank you! It works