Skip Navigation

[Resolved] Repeating Fields

This support ticket is created 6 years, 9 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 16 replies, has 2 voices.

Last updated by Beda 6 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#614752

I am a developer and have been using toolset for sometime. Currently, I am working on probably, the most complex project I have ever attempted with or without Toolset.

We are trying to duplicate a group of fields for our users on a front end form. I do not currently have a place I can send you to as an example as I am developing locally on my localhost but let me try to explain.

We are getting ready to implement a signup for our site. This signup page will be a gravity form that once completed the user will be forwarded to an "interview" page.

This interview is going to have 4 sections

Education, Work/Military, Family, and Important Events
Lets take education as an example.
We need to be able to ask someone for the name of a school along with their start date and end/graduation date. All three of these fields will need to be duplicated in an intuitive way when the user clicks an option to add a school.

I am using the "Forms" and Views features of Toolset to create the interview page on the front end for users and I might be missing something or merely misunderstanding how things work.

Is there any documentation that you are following?
I looked a this part of the documentation: https://toolset.com/documentation/user-guides/repeating-fields/#Groups%20of%20Repeating%20Fields

What I am confused about is do I need to create custom post types to make the field groups? I also wonder is there a way to make it so that only the admins of the site and the user who fills out this interview can see the data attached to it?

Unfortunately, I am not able to provide a live version at this time for you to see.... however, I did create a demo page using gravity forms that does what we are trying to accomplish with toolset.. you can see that here: hidden link

Under education you will see a field that asks "Are you still attending this institution?" Under the drop down there is a small '+' sign that when clicked duplicates the set of fields with conditional logic and all... This is what we want to do with Toolset and I am confused if I need to create custom post types for each section of the interview form.

Thanks in advance for your help.

Sincerely,
Davood Denavi
Website Developer & Webmaster

#614855

I understand the task you took.

It's currently not possible with CRED, however there are 2 major things you need to know:

1. It is currently possible to add Repeating Fields to any Post type, and the CRED forms.
This means, you can add single Fields, like single lines, to your Posts, and have them repeatable.
But, this is usually useless for later display, as in your case.

2. To have the kind of repeating fields (groups) as you describe you need to have a whole post for each group of repeating fields.
That is why in the DOC, we suggest a Child Post type, where you have several single fields stored in each post, and for each "group" of fields you need, you create a new child post.

This is possible in the WordPress Backend right now.
When you create a parent Post and save it, then you can add Child Posts and directly also edit the new field values.

In CRED, this is not possible.
You need right now to link to another page, where you create ONE child post a time.

This will be different very soon.
The "to be released" Beta versions (this will happen within a week or 2 at max), will include a first working version of CRED with the new many to many features.
And that, will enable exactly the feature you look for.

In the final, stable release, you will be able to create child posts (and with this, repeating field gourds) from within the parent CRED Form.

Unfortunately I cannot provide a working version of this right now, and with the sable versions, there is no solution other than what above described - unless of course, you will apply complex Custom Code.

I can notify you here when first versions of this are testable.

Is this OK?

#614875

Are you saying that in a future update groups of repeating fields will be possible without the child posts? Or will it still use child posts but be possible to add that to the front end form that I sent a sample to as well?

#614881

It will use the same approach of types, which is to create repeating posts with each a set of fields.

Hence it will use the new Many To Many relationship features.

#614883

I am actually doing some testing on my end and I think I can in fact already do what I am trying to do. Let me ask you something though. Is there a way to hide the main 'post body' field from my custom post types?

#614891

So, I reread your most recent reply....

This is a one-to-one relationship...
each user can only fill out the interview once.
However, they can have multiple things under each section of the interview.
Therefore, we need to be able to duplicate the fields under each section.

Again the four sections are Education, Military/Work Experience, Family, Important Events.

Lets take Education as an example...
Some users will have five schools they want to enter in the interview. Therefore, they will need to intuitively duplicate the following set of fields and fill them out for each school:

School Name
Start Year
Still attending?
End/Graduation Year

In effect this is a one-to-many relationship not a many-to-many relationship.
One interview/user to many schools.

Is this possible currently using front end forms and custom child posts?

#614893

Yes, the new Many to Many relationship also will include updates on how you set up one to one relations.

And for the goal you try to achieve, you need a post relationship, even if just a one to one or one to many.

It's currently not possible to set those up in one flow, using CRED.

This will be possible commencing with the Beta's, and completing with the stable release to come.

#614909

So here is what I thought of and I think it will solve the problem for this project.

I created a signup from using Gravity Forms that creates an account with subscriber rights.

Gravity forms allows me to send the user to a custom URL after signup. I was thinking if there is a way to send the user to the backend where they can create a new interview the problem would be solved because the admin view for creating the post type is very intuitive.

This would also require hiding the main "post body" field on the interview post type and limiting the users to only creating one interview. I intend to allow my users to write blog posts too so I would need to limit them to only seeing their own blog posts.

Is this workaround possible using Toolset??

#615575

Only partially.

With Toolset Access you can control who can edit/create what in the backend, but not to the extent you need (for example, you cannot limit the amount of posts created)

You can redirect as well with CRED forms, that's not the problem, we have 2 features for that, one in the GUI, where you can choose from existing pages or posts, and by API, where you can redirect wherever you want:
https://toolset.com/documentation/programmer-reference/cred-api/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

To limit the amount of Posts you need Custom Code that queries all posts of a certain type by a certain user and then counts those posts, returns the amount existing and then you use that in conditionals, as example you will redirect to the backend only if there is less than one such post, if there is one or more, to the front end.

This requires custom code thou, that we can assist only limitedly here in the forum.
I have some threads where other users wanted something very similar:
https://toolset.com/forums/topic/cred-multiple-submission/#post-376330 > Step 2
https://toolset.com/forums/topic/conditional-user-has-post-with-parent-current-page/
https://toolset.com/de/forums/topic/limit-the-number-of-posts-submitted-by-registered-customers/
https://toolset.com/forums/topic/limit-submissions-per-session-per-user-per-time-period/#post-424560

This should help to count the posts per user.
Then, use that to create PHP conditionals where you decide if or not to redirect.

I also just got word about the Repeating Fields Groups in the coming up betas and next versions.
The coming Beta will not yet include a working CRED version where you can add several Child Posts from the Front End, but only one a time.
But with further development this will also be applied to CRED in future versions.

Views, on the other hand, is not yet ready to display those fields of repeating groups properly.
This will also be done in either the upcoming beta, or a next version.

#615634

Thank you so much for providing that info. I will review it closely today.

A few things though from quickly skimming it.

1) I want to allow them in the backend even after the posts are created to edit their interview. The product we are creating allows people to go back later and edit their interview to add more events. Is that as simple as not blocking them from the backend once the interview is created?

2) Is there a way to hide the default posting body field and change the default text on the post title field for my interview post type?

3) Is it possible to either auto save after the interview title is entered or maybe instead of auto saving after the title is entered I can create a front-end form for the main interview questions then when they click submit on that it forwards them to the backend?

4) I was testing Toolset Access last night and I believe it will work if when the user is created I make them an Author. However, what is unclear to me is how to make it so that when the list comes up users will only see their own posts. in the list. Is this possible? If not, is it possible to forward regular subscribers to the backend?

Thank you so much for your continued help with all of this. I am behind deadline on this project and was running out of ideas. It is also hard to scour the forums and documentation looking for some of the things that you have linked me to because I did not even know what search terms/phrases to use.

Sincerely,
Davood Denavi
Website Developer & Webmaster

#615944

1. Theoretically yes, of course.
With Access, you can control who can edit what, and you can make sure they will eat only their own posts.
They will still see other's posts, but not be able to edit them.

2. The same rule can be applied (with more control) to CRED forms.
Basically, you can port your entire Backend to the Front End with CRED.
But, as mentioned, the way of adding child posts is different in the current CRED than in the backend of Types.

3. You can hide the post body in Toolset > Post Types > you_post_type > edit > Sections to display hen editing (your_post_type) > Editor
Disable that.
This will remove the post body from your posts.

4. It's not possible to alter the default placeholder or title label of native WordPress backend post edit screens with Toolset.
It is eventually possible with custom code, but that is out of scope of the support here.
hidden link
hidden link

5. WordPress has an autosave mechanism, but what you are looking for is not possible without custom code.
Here eventually you would need to hook into save_post and redirect to another URL upon save action.
I am not sure this is the best solution.

I would keep it all in the backend or front end, but not both together.
I personally would wait until CRED has it's features fully implemented, and until then, expect my visitor to create one child post a Time.
But, that may differ in the specs, and hence you may not have time for this

Right now, the approach you suggest needs elaborated custom code

6.

However, what is unclear to me is how to make it so that when the list comes up users will only see their own posts. in the list

In the backend?
No.
But, you can control that they cannot edit them. The visibility alone, is granted if you can edit any post, logically, you cannot hide them totally.

In the front end you'd use a Post View, and apply a Query Filter like "Select posts with the author the same as the current logged in user."

That would then show a list of posts that belong to the current user only.

7. Yes, knowing what to search for (exact terms) is half the search.
And another half is a good search engine.

For advanced search in our forum, I honestly recommend another approach.
Use google search syntax like this:

site:<em><u>hidden link</u></em> search terms here

This will force google to search only the Website indicated, and only search for the terms you add in the query.
It's very helpful, you can narrow down the results much easier (IMHO).

Also helpful is to know where to find the related DOC.
I always start here:
https://toolset.com/documentation/user-guides/

Your main topics are covered in Access, Views and CRED tabs.

Please let me know if I can help with anything else?

For specific single issues, I recommend to open a ticket for each.
Then, we can be of more detailed help as well

Thank you!

#625722

This ticket is not yet resolved. I have been researching some of the things that have been discussed in this thread and may have further questions soon. I would like to keep the thread open so I can keep the conversation in one place.

I will be in touch on this again soon. Thank you for understanding.

Sincerely,
Davood Denavi
Website Developer & Webmaster

#625723

Please open new threads for every single question or issue.

It will not only allow us to give tailored assistance but also you to find the answers quicker in future, as well as other users will benefit from a less nestled Support Topic handling.

Here we can handle issues of repeating fields, which are addressed in this response:
https://toolset.com/forums/topic/repeating-fields-2/#post-614855

#625730

I understand you prefer new threads for each question... However, really, I am still researching solutions for the problems that have been discussed in this thread and need the conversation to stay here. Please keep this thread open. I will tag it completed when the project is completed.

Thanks again.

#625731

I do not have the power to stop the robot.

The robot will nag you in about 3 days to review this Thread.

The thread needs to stay on topic as per our Support Rules:
https://toolset.com/toolset-support-policy/

I can always as well split a new ticket from this existing ones if I feel the questions are going too much off topic and proceed in the new tickets.

Please let me know if you have more doubts about the Repeating Fields Issue.

Thank you!