Sauter la navigation

[Résolu] getting error when i try to use a multi field group in a multistep form.

This support ticket is created Il y a 3 années et 2 mois. 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)

Ce sujet contient 37 réponses, a 2 voix.

Dernière mise à jour par Luo Yang Il y a 3 années et 1 mois.

Assisté par: Luo Yang.

Auteur
Publications
#2199035

I have a CPT rendering basically a membership setup.
A WordPress user managing the editor's login.
The structure: A CPT editors profiles
The CPT is linked to the "currently logged in users" user's account.
The process is New editor registers account on WordPress.
The email is verified with the verification plugin and then automatically redirects to creating an editor profile step one once verified.
The Editors profile step one form consists of a 4 step (multistep cred form) form.
Once all the steps have been completed the profile is submitted and for approval by site admin and payment confirmation (this is a manual process so no implementation issues)
Once the profile has been vetted and payment confirmation has been received the site admin manually approves the profile and an automated link is sent to the user to complete his/her profile. This is the same CPT as above with step One. Just this time does include all the fields of the CPT (9 Multistep form)
his is all working seamless.
The challenge: one of the Multistep forms has a form that contains the qualifications of the User. Currently, we use 4 (fixed amount) fields ( with multifield option available. This does render a bit messy report. So we have decided to look into the option of using a multi-field group in the multi-step post form. The results should be that an Editor can list unlimited Qualifications. The current
setup for the multifield group consists of two fields. "types of qualification" and "qualification name"
How do I integrate a multi-field group into a multistep form? We did ask this question in a previous ticket ##2190567.

I did implement the solution from that ticket "Check our documentation for RFG forms here https://toolset.com/course-lesson/front-end-forms-for-repeatable-field-groups/" However when the form reached the Qualification page it generates an error " "Form type and post type do not match" - Toolset. The problem we are currently facing is this is a live production site and we can not allow that error to show.

I have for this exercise created a dummy set up to test.

To test the system you need to login via this this link:
lien caché
And use the username hermanolivier64 with the appropriate password.

This will take you to the correct form to test. It will be screen 6 on the multistep form.
The link is lien caché

#2199445

Hello,

The test site you provided above is not valid to debug, I get 503 errors after login into the test site, please provide a copy of your website in below private message box, you can put the package files in your own google drive disk, share the link only, also point out the problem page URL and view URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/

#2200189

Thanks for the details, I am downloading the files, will update here if find anything

#2200205

I can see the problem with the duplicator.

I assume we are talking about the content templet "Editors profile completeness form 6", it is display below post form "Editors profile completeness form 6":
lien caché

Which is for editing another post type "Qualifications", so it conducts the problem you mentioned above:
Form type and post type do not match

Toolset repeatable field groups are based one-to-many relationship, which means each item of repeatable field groups is also a single post, the post type slug is same as repeatable field groups slug, in your case, it is "Qualifications".

I suggest you try to follow our document to manage the child "Qualifications" post in single "Editors profile" post:
https://toolset.com/course-lesson/front-end-forms-for-repeatable-field-groups/

#2200491

HI Luo,

You are correct.
I am still bit lost. I have followed the instructions and have created a post form "Qualification Repeatable form for add new Editors"

Where I am now is I have to add this to the "Editors profile completeness form 6". we are using a multistep form of which the aforementioned form is part of a multi-step form of 9 front end forms. I am not able to figure out how to add the form to the Editors profile completeness form 6.

#2200535

I suggest you try these:
In the single "Editors profile" post, display below post form + post view:
1) Post form for creating new child "Qualifications" post
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/
2) Post view:
- Query "Qualifications" post
- Filter by post relationship between "Editors profile" and "Qualifications"
- In views loop, display editing "Qualifications" post form link
https://toolset.com/course-lesson/front-end-forms-for-editing-content/

#2200583

Luo,

I am very lost right now. I feel as if we are trying to present the entry rather than capturing the data.

Maybe let me explain it a bit more comprehensively.

I have a CPT editors Profile.
This CPT has a very large amount of custom fields.
Because of this, we opted to go with a multistep form. ie split the fields into 9 different forms. These forms are accessed via code that moves from form to form sequentially "Editors profile completeness form 6" forms no 6 of 9 screens. The way the multistep was done was to create the CPT with its fields. Then I made a post form and each of the post forms was wrapped in a template. The form 1 template was then linked to the page to capture as a template and the following code

/** Multistep form "Editor" profile completeness for 9 pages*/

add_filter('cred_success_redirect', 'step2b_redirect_func',10,3);
function step2b_redirect_func($url, $post_id, $form_data)
{
    if ($form_data['id']==1437)
    {
       	$arr = array('content-template-id'=>1551); /*the step 2 template ID*/
        $url = add_query_arg($arr, $url);
    }
    return $url;
}

Jumping from one screen to the other.

Via the form ID and the template id, this is effectively turned into a multi-screen form.

My problem is specifically Editors profile completeness form 6. Currently, we have 4 fields for Qualifications. Based on the four types of degrees. we are changing the structure that each field will contain the type of qualification and the name of the qualification. This was achieved by using a repeatable field group. we want the editor to be able to list qualifications and not have empty fields in their profile template.

I now need to add the qualification form to the multistep form no 6. Unfortunately, none of your suggestions makes sense or work.

#2201315

Let me describe the problem again:
1) Toolset repeatable field groups are based one-to-many relationship, "qualification" is a different post type from "Editors profile", you can not use "qualification" post form to edit/create "Editors profile" post.

2) I have already provided the link of "Front-end Forms For Repeatable Field Groups in WordPress" document above:
https://toolset.com/course-lesson/front-end-forms-for-repeatable-field-groups/
You just need to follow above document to setup the post view + post forms, see my above answer:
https://toolset.com/forums/topic/getting-error-when-i-try-to-use-a-multi-field-group-in-a-multistep-form/#post-2200583

Please let me know if you need more assistance for it, I can setup a demo in your website

#2203653

Hi Luo. i am not being able to get the instructions to work. I would appreciate it if you could set up a Demo. I both need to figure out how to ass the Education fields when a profile is created and then again how to get it to display in the User/editor profile.

Much appreciated

#2204543

I have done below modifications in your website:
1) Create a post form for creating new "qualification" post: Add Qualifications form
lien caché
In the "Editor Profile", setup the default value as shortcode: [wpv-post-id item="$current_page"]

2) Create a post form for editing "qualification" post: Edit Qualifications post
lien caché

3) Create a post view: My Qualifications
- Query "qualification" post
- Filter by
Select items from the Qualifications group that are related to the Post where this View is shown.
- In view's loop, display the post title + edit post form: Edit Qualifications post

4) Edit the content template "Template For single editors profile":
lien caché
At the page bottom, add a conditional block, with below condition:
Author ID from Current Editor Profile is equal to Current user.
And display the post view of step 3) + post form of step 1)

Please test it, check if it is fixed, thanks

#2205737
Screen shot1.png
Screen shot 3.png
Screen shot 2.png
Screen shot 4.png
Screen shot 5.png
Screen shot 6.png

I have been able to recreate most of your changes to my life site. Everything seemed to work perfectly and I understood the logic of it, however when I came to the query filter of the view I encountered an issue. It seems that the query is not there.

Screenshot 1, 3 and 5 are the staging site's filters that you created. Screenshot 2, 4 and 6 are the live sites filter. You should be able to see the difference in the screenshots.
Screen shot 5 and 6 show that in the staging site there is a template in use, is screenshot 6 there is no options to use a template.

#2205811

It should be a cache issue, and it won't take effect on the results, you can clear your browser cache or try with another browser, and test again

#2207751
image 2.png
image 1.png

Hi Luo

TheCache issue was resolved. Now I think i have my last query on this issue.

On the view you did for My qualification lien caché
you have a section "Templates for this View" Image 1
However, on the live site, this is missing. Image 2.

Then my last step is to include the view into the on step form no 6. Image 3. Do I just add the view above into the path?

#2208561

There isn't such kind of built-in feature, but it is possible with cred_success_redirect filter hook.

For example:
1) Put the post view "My Qualifications" + post form "Add Qualifications form" into content template "step form no 6"
2) After user submit above forms, use filter hook cred_success_redirect to redirect hem back to URL of content template "step form no 6"

See our document:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

#2211753
Image 3.png

Hi Luo,

Thank you for your previous comment. I am however still not getting this right.

I have followed the instruction on the add qualifications to the profile completeness and it did work with the exception that on the profile completeness it ask you to select the editor it must link to. I need this to be an automated process to link to the current profile user.
2nd issue is it does not redirect back to the template if they need to add a second entry.