Skip Navigation

[Resolved] No option to add repeating field group in Toolset Forms

This support ticket is created 5 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Tagged: 

This topic contains 13 replies, has 4 voices.

Last updated by Nigel 3 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1305253

I am trying to add a repeating field group in a Toolset form.
But it dosent show up when im adding fields in the form

Repeating fields groups can be added in form, is that correct?

#1305471

Adding RFG (Repeating Field Groups) in a Toolset Form is not possible when adding or editing Posts to which the RFG are assigned, but only if you create a specific Form, which creates or edits RFG.

This is elaborated here.
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/front-end-forms-for-repeatable-field-groups/

To have a Form to submit a Post AND the RFG in one form, you'd have to ask for this feature here https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/

Please let me know if something's not clear!

#1305515

I just read the article. Could you elaborate the "but only if you create a specific Form, which creates or edits RFG."
What i am doing is creating a form and want a group of fields repeated. Based on the article i can create a form that add data to the fields of RFG but not RFGs of a custom post, is that correct?

#1305523

As I mentioned earlier and the Document elaborates you need a form that creates or edits RFG (repeatable field group) and not a form that creates or edits the post type to which the RFG is addded to.

So if your RFG Field is "my RFG field" then you should create a Toolset Post Form Editing or Creating "My RFG Field"
Then you insert that to a page and create or edit RFG items.

You can, of course, add RFG to a Post, it's what it is made for.
The difference in backend and front end is, that in the backend you create a post, and add infinite RFGs.
In the front end you create a post, then on another form, you create ONE RFG item a time and connect it to the post.
You cannot add many RFG like in the backend within the same action.

Does that help?

#1305637

Thanks for clarifying this. After playing with this for a bit i can see its pretty useful on the backend but not helpful on the frontend cause you need to submit the form once at a time, also as you mentioned you need to relate it to the current post.

Thank you for your help.

#1306335

Yes, this is how the Form works in the Front End.
I suggest to write in to https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/, with suggestions about new features related to this.

If you'd like to suggest particular usage issues, I can record them here.
Usage issues would be problems that happen with the current working setup.
Features are things that are not possible with the current setup. Those, I cannot record in this forum, you'd need to do it at the above-shared link.

Now, I am ready to take the challenge of trying to create something more fluid, with some smart placing of forms and maybe a custom snippet or two, so you'd have a similar-to-backend experience in the Front end, but remember, it's not officially supported the exact same way.
If you'd like, we can try to set up a flow that is more smooth and similar to the backend, together.

For example, we could have the Form setting a specific post as the parent, so you'd not need to choose it (same as in the backend).
I think we might also manage to create a similar experience to the backend - I imagine a form, where you'd add the RFG details, save, and that would update the screen with what you added + show the form again, just below it, to add more.
Eventually, there could even be an edit link, on each RFG item, so you could even edit those items (maybe on a separate page).

I'd need to know some specifications for your idea about how it should work precisely, and maybe you could set up (or have already) a staging site where we could work just on this Form process?
It'd be better than doing this on a live site, as eventually, we'll maybe need some code, and depending on your description things may simply not be possible, so we wouldn't waste precious live server space and hits if we need to change or cannot implement a solution.

What do you think?

#1307855

Apologies for the late reply. Thanks for taking interest in this.
What i have is a simple Video request form , created with toolset forms , with normal fields like title of custom post etc. , i needed a repeating field in the form to act as a timeline.
For example an input field that the user writes time like on [ 00:04:00 text text] which can already be achieved with just a repeating field. What i initially wanted was an RFG with two fields time and text next to each other , same idea as before but RFG.
As you mentioned thats not possible so i was thinking after the user submits the form redirect the user to the post created and there will be and RFG form.

Something like that.

#1308523

I understand your goal.

Yes, we'll need to save the Post at least once before we can add RFG in the Front End with Forms.

The process would be (classically), to create an Add Posts Form, redirect that to another form, where you can add RFGs.

To make this smoother, you can:

- In your "Add Posts" form, redirect to any page, where you will insert the "Add RFG" Form
- In the RFG Form, in the field where you are supposed to choose the post the RFG belongs to, set it to listen to an URL parameter, like this example:

 [cred_field field="@rfg.parent" class="form-control" output="bootstrap" select_text="--- not set ---" urlparam="belongs_to"]. urlparam="belongs_to" is what you want to set.

- Now you need to tell the "Add Posts" Form, which redirects to the Page where the RFG Form is, to add the above URL parameter urlparam="belongs_to", to the URL. You can do this with the Forms API Hook here:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
The code for this is very simple, you'll just take the existing redirect URL (which you set in the Add Posts Form) and append a URL parameter:

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    if ($form_data['id']==27) {
        //return '<em><u>hidden link</u></em>';
    	$url = $url . '?belongs_to=' . $post_id;
        //error_log(print_r($url, true));
   	}
    return $url;
}

- Now insert the RFG Form in the Page where to the Post Form redirects.

If you now submit a Post with the "Add Post" Form, you'll be redirected to that page with the RFG Form.
Since you placed above code in the Theme's Functions File or in Toolset > Settings > Custom code, the URL param ?belongs_to=POSTID is added to the URL.
POSTID here is the ID of the post you just created with the Add Post Form.
Since the RFG Form listens to that URL parameter, it'll set the parent (the post it belongs to) automatically to the post you just created.

The problem now here is that after AJAX Submit the Field is not updated with the still existing URL parameter, that is a problem that we'd have to solve with some JS, I'll come back to this after some tests.

#1308621

I believe this is a BUG because we say that you can listen to an URL parameter, but we never say that this wouldn't work after an AJAX submit, in fact, it has to work after any submit.

Currently, you could add the URL param value with some JS, but that's no permanent solution.

I've escalated this as a BUG, so we can solve it and maybe produce a workaround.

#1309747

Hello Beda

This looks nice! i will try it and let you know.

Thank you for your help

#1310279

The issue where the Select2 does not listen to the URL param after an AJAX submit was escalated to Toolset Form's Developer, who will look into it.

I'll keep you updated here in regard.

#1463951

Adding a bump on this. Front end user ability to easily add items to a post is essential. I've spent the day trying to do this before landing on this thread.

#1550563

The feature should be suggested here https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/, so the product manager can take note of the number of users and eventually plan it for Toolset Development Cycles.
See also https://toolset.com/forums/topic/no-option-to-add-repeating-field-group-in-toolset-forms/#post-1305471

This ticket here is only for the issue mentioned here https://toolset.com/forums/topic/no-option-to-add-repeating-field-group-in-toolset-forms/#post-1310279

I'll keep this ticket updated about news related to this BUG:
https://toolset.com/errata/parent-post-selector-in-a-form-that-creates-a-repeatable-field-group-is-not-being-updated-after-ajax-submission/

#2125127

Nigel
Supporter

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

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

Please note that the fix for this issue is now available with the recent plugin updates.

If you don't see an update notice on your plugins page, click the registered link for one of the Toolset plugins to take you to the custom Toolset installer page, and use the Check for Updates button, otherwise you can download the latest versions from your downloads page at toolset.com/account/downloads.

Thanks for your patience!