Hey,
you got a nice plugin there! I’d like to make our plugins compatible also. Could you give an example of how a user would use both our plugins and what problems they would have as of right now? I’m not sure I’m seeing the issue.
Hey Webhead,
thanks for the positive answer 🙂
Here is an example of both our plugins combined: http://bdwm.be/wpcf7cf/multistep/
(Note that I have added some tabs to each form to also show you the form code and the conditions that are used. This is not part of my plugin though.)
Let me first quickly explain how my plugin works:
1. you can wrap any part of the form in [group group-name][/group]
tags, called a group
2. The contents of each group are hidden by default.
3. The user can define some conditions that will make the group contents appear.
This is the basic functionality of the plugin, and all this works fine in combination with your plugin.
However! There is an extra feature. Namely, the groups can also be used in the email message. For example if in the email body you write: [group-1]TEXT[/group-1]
, The text “TEXT” will only be visible if group-1 was visible in the form.
Now I achieve this by adding the hidden groups to a hidden field in the form, so it gets sent with the POST data, and based on this I can figure out which groups should be shown/hidden in the email message. This works for the last step of the form. But not for all the previous steps of the form. So if in Step 1 [group-1] was shown, this data is POSTed to step 2, but after submitting step 2 the information is lost.
I hope the problem is clear now 🙂
BTW: Feel free to submit the form on my website, the email message will be shown as output on the page, so you can see the resulting email.
-
This reply was modified 7 years, 1 month ago by Jules Colle.
-
This reply was modified 7 years, 1 month ago by Jules Colle.
Thanks for the example. I see the problem now. Having a multidimensional array for for each step sounds like a good idea, but I really don’t have the time to make major changes like that. Do you think it could work if i added a couple of hooks in the cf7msm_store_data_steps_filter
function? like maybe a filter for $cf7_posted_data
right before merging the prev and current data?
Hey, yeah that might help. I was trying to get it to work now by always adding the cookie to the posted data. But that seems to fail now as well.. At first I thought the last step of the form was submitted like a normal form (so the POST data would be accessible), but when I test it now (after last update), it looks like the last step is submitted and then the form is redirected again, loosing the POST data. Is that right?
So yeah, a hook/filter might be the only way. I will add one myself to your code to see if it works, and let you know the exact spot where to add it.
Never mind. Your answer pointed me in the right direction and there is no need for an extra hook.
I can just use the 'wpcf7_posted_data'
filter to update the posted_data before your plugin starts using it. I used a priority of 8 (where you use 9) to achieve this
if (!function_exists('cf7msm_get')) add_filter( 'wpcf7_posted_data', array($this,'cf7msm_merge_post_with_cookie'), 8, 1 );
I’m testing this now and will release the update soon. Thanks for the help! And thanks for the great plugin!
Oh right you can just use cf7’s filter. Glad you got a solution!
To answer your question about the last step, it submits the data and sends the email the same as a normal form, then redirects to a new URL if the user entered an additional URL (losing the POST data at this time). If the user didn’t enter a URL on the last step it just shows the success message like a normal form.
Please update this thread when you release. I’d like to try it out. 🙂
Any news on this?
I’m interested in this exact issue too.
yes, this is possible now. topic is resolved
Can you confirm this works with your plugin version 1.3.1?
Because I have troubles displaying conditional fields value on step 2 of a 2 step form.
Here’s the code I’m using (simplified)
Step1
[group timegroup][group timegroup2][group timegroup3]
<label>Service time
[select* time "" "07:00" "08:00" "09:00" "10:00"]</label>
[/group][/group][/group]
[group smallhours]
<label>Service time
[dynamicselect hours "wpcf7_dynamic_select_hours"]</label>
[/group]
Step 2:
You are booking for this time [timegroup][timegroup2][timegroup3][multifom "time"][/timegroup][/timegroup2][/timegroup3] [smallhours][multiform "hours"][/smallhours]
-
This reply was modified 6 years, 11 months ago by banelicious.