Version Description
- fixed conditional fields not trigerring after form population.
- fixed 500 error due to conflict with Conditional Fields plugin expecting an array in cookie values.
Download this release
Release Info
Developer | webheadllc |
Plugin | Contact Form 7 Multi-Step Forms |
Version | 4.1.6 |
Comparing to | |
See all releases |
Code changes from version 4.1.5 to 4.1.6
- cf7msm.php +14 -0
- contact-form-7-multi-step-module.php +2 -2
- js_src/cf7msm.js +3 -0
- readme.txt +6 -2
- resources/cf7msm.min.js +1 -1
cf7msm.php
CHANGED
@@ -197,6 +197,20 @@ function cf7msm_get( $var_name, $default = '' )
|
|
197 |
$ret = json_decode( wp_unslash( $ret ), true );
|
198 |
}
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
return cf7msm_sanitize_posted_data( $ret );
|
201 |
}
|
202 |
|
197 |
$ret = json_decode( wp_unslash( $ret ), true );
|
198 |
}
|
199 |
|
200 |
+
// Conditional Fields plugin throws 500 error when these aren't set.
|
201 |
+
|
202 |
+
if ( $var_name == 'cf7msm_posted_data' && class_exists( 'CF7CF' ) && method_exists( 'CF7CF', 'cf7msm_merge_post_with_cookie' ) ) {
|
203 |
+
if ( !isset( $ret['_wpcf7cf_hidden_group_fields'] ) ) {
|
204 |
+
$ret['_wpcf7cf_hidden_group_fields'] = '[]';
|
205 |
+
}
|
206 |
+
if ( !isset( $ret['_wpcf7cf_hidden_groups'] ) ) {
|
207 |
+
$ret['_wpcf7cf_hidden_groups'] = '[]';
|
208 |
+
}
|
209 |
+
if ( !isset( $ret['_wpcf7cf_visible_groups'] ) ) {
|
210 |
+
$ret['_wpcf7cf_visible_groups'] = '[]';
|
211 |
+
}
|
212 |
+
}
|
213 |
+
|
214 |
return cf7msm_sanitize_posted_data( $ret );
|
215 |
}
|
216 |
|
contact-form-7-multi-step-module.php
CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://www.mymonkeydo.com/contact-form-7-multi-step-module/
|
|
6 |
Description: Enables the Contact Form 7 plugin to create multi-page, multi-step forms.
|
7 |
Author: Webhead LLC.
|
8 |
Author URI: http://webheadcoder.com
|
9 |
-
Version: 4.1.
|
10 |
Text Domain: contact-form-7-multi-step-module
|
11 |
*/
|
12 |
/* Copyright 2018 Webhead LLC (email: info at webheadcoder.com)
|
@@ -68,7 +68,7 @@ if ( function_exists( 'cf7msm_fs' ) ) {
|
|
68 |
cf7msm_fs();
|
69 |
// Signal that SDK was initiated.
|
70 |
do_action( 'cf7msm_fs_loaded' );
|
71 |
-
define( 'CF7MSM_VERSION', '4.1.
|
72 |
define( 'CF7MSM_PLUGIN', __FILE__ );
|
73 |
define( 'CF7MSM_FREE_TEXT_PREFIX_RADIO', '_wpcf7_radio_free_text_' );
|
74 |
define( 'CF7MSM_FREE_TEXT_PREFIX_CHECKBOX', '_wpcf7_checkbox_free_text_' );
|
6 |
Description: Enables the Contact Form 7 plugin to create multi-page, multi-step forms.
|
7 |
Author: Webhead LLC.
|
8 |
Author URI: http://webheadcoder.com
|
9 |
+
Version: 4.1.6
|
10 |
Text Domain: contact-form-7-multi-step-module
|
11 |
*/
|
12 |
/* Copyright 2018 Webhead LLC (email: info at webheadcoder.com)
|
68 |
cf7msm_fs();
|
69 |
// Signal that SDK was initiated.
|
70 |
do_action( 'cf7msm_fs_loaded' );
|
71 |
+
define( 'CF7MSM_VERSION', '4.1.6' );
|
72 |
define( 'CF7MSM_PLUGIN', __FILE__ );
|
73 |
define( 'CF7MSM_FREE_TEXT_PREFIX_RADIO', '_wpcf7_radio_free_text_' );
|
74 |
define( 'CF7MSM_FREE_TEXT_PREFIX_CHECKBOX', '_wpcf7_checkbox_free_text_' );
|
js_src/cf7msm.js
CHANGED
@@ -141,6 +141,9 @@ var cf7msm_ss;
|
|
141 |
|
142 |
}
|
143 |
});
|
|
|
|
|
|
|
144 |
|
145 |
|
146 |
}
|
141 |
|
142 |
}
|
143 |
});
|
144 |
+
|
145 |
+
// if using conditional fields, get it to do its thing
|
146 |
+
cf7msm_form.find('input[name="_wpcf7cf_options"]').trigger('change');
|
147 |
|
148 |
|
149 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: webheadllc
|
|
3 |
Donate Link: https://webheadcoder.com/donate-cf7-multi-step-forms
|
4 |
Tags: contact form 7, multistep form, form, multiple pages, contact, multi, step
|
5 |
Requires at least: 4.7
|
6 |
-
Tested up to: 5.
|
7 |
-
Stable tag: 4.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -135,6 +135,10 @@ When checkboxes are not checked they aren't submitted through the form so the la
|
|
135 |
|
136 |
== Changelog ==
|
137 |
|
|
|
|
|
|
|
|
|
138 |
= 4.1.5 =
|
139 |
* fixed prev button not showing up when next url from previous form has a querystring in it.
|
140 |
* fixed issue with cookie being set on non-multistep forms.
|
3 |
Donate Link: https://webheadcoder.com/donate-cf7-multi-step-forms
|
4 |
Tags: contact form 7, multistep form, form, multiple pages, contact, multi, step
|
5 |
Requires at least: 4.7
|
6 |
+
Tested up to: 5.8
|
7 |
+
Stable tag: 4.1.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
135 |
|
136 |
== Changelog ==
|
137 |
|
138 |
+
= 4.1.6 =
|
139 |
+
* fixed conditional fields not trigerring after form population.
|
140 |
+
* fixed 500 error due to conflict with Conditional Fields plugin expecting an array in cookie values.
|
141 |
+
|
142 |
= 4.1.5 =
|
143 |
* fixed prev button not showing up when next url from previous form has a querystring in it.
|
144 |
* fixed issue with cookie being set on non-multistep forms.
|
resources/cf7msm.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}({6:function(e,t,n){e.exports=n(7)},7:function(e,t,n){"use strict";n.r(t);var r,i;n(8);function o(){try{return sessionStorage.setItem("test","test"),sessionStorage.removeItem("test"),!0}catch(e){return!1}}i=jQuery,document.addEventListener("DOMContentLoaded",e=>{var t=cf7msm_posted_data,n=i("input[name='_cf7msm_multistep_tag']"),s=n.length>0;if(s||(s=(n=i("input[name='cf7msm-step']")).length>0),s){var a=n.closest("form"),f=a.find('input[name="_wpcf7"]').val();o()?null!=(r=sessionStorage.getObject("cf7msm"))&&i.each(r,(function(e,t){if("cf7msm_prev_urls"==e){var n=a.find(".wpcf7-back, .wpcf7-previous"),r=window.location.href,i=r.replace(/\/$/,""),o=!t.hasOwnProperty(r)||""==t[r];o&&(o=!t.hasOwnProperty(i)||""==t[i]),o&&(r=r.split("?")[0],i=r.replace(/\/$/,""),(o=!t.hasOwnProperty(r)||""==t[r])&&(o=!t.hasOwnProperty(i)||""==t[i])),o?n.hide():n.click((function(e){t.hasOwnProperty(r)&&""!=t[r]?window.location.href=t[r]:t.hasOwnProperty(i)&&""!=t[i]?window.location.href=t[i]:window.history.go(-1),e.preventDefault()}))}})):(i("input[name='cf7msm-no-ss']").val(1),i(".wpcf7-previous").hide());var c=wpcf7.submit;wpcf7.submit=function(e,t){!function(e){!function(e){var t=e;t instanceof jQuery||(t=i(e));var n=t.find("input[name='_cf7msm_multistep_tag']");0!=n.length&&(n.length>1&&(n=n.last()),i("<input />",{type:"hidden",name:"cf7msm_options",value:n.val()}).appendTo(t))}(e)}(e),c(e,t)},window.addEventListener("load",(function(){t&&i.each(t,(function(e,t){if(e.indexOf("[]")===e.length-2&&(e=e.substring(0,e.length-2)),(0!=e.indexOf("_")||0==e.indexOf("_wpcf7_radio_free_text_")||0==e.indexOf("_wpcf7_checkbox_free_text_"))&&"cf7msm-step"!=e&&"cf7msm_options"!=e){var n=a.find('*[name="'+e+'"]:not([data-cf7msm-previous])'),r=a.find('input[name="'+e+'[]"]:not([data-cf7msm-previous])'),o=a.find('select[name="'+e+'[]"]:not([data-cf7msm-previous])');n.length>0?"radio"==n.prop("type")||"checkbox"==n.prop("type")?n.filter((function(){return i(this).val()==t})).prop("checked",!0):n.is("select")?n.find("option").filter((function(){return this.value==t})).attr("selected","selected"):n.val(t):r.length>0&&t.constructor===Array?""!=t&&t.length>0&&i.each(t,(function(e,t){r.filter((function(){return i(this).val()==t})).prop("checked",!0)})):o.length>0&&t.constructor===Array&&""!=t&&t.length>0&&i.each(t,(function(e,t){o.find("option").filter((function(){return this.value==t})).attr("selected","selected")}))}}))})),document.addEventListener("wpcf7mailsent",(function(e){if(o()){var t=0,n=0,s=[],a={};(r=sessionStorage.getObject("cf7msm"))||(r={});var c=!1,u=!1,p=!0,l=!1,d=null,m=!1;if(i.each(e.detail.inputs,(function(r){var o=e.detail.inputs[r].name,v=e.detail.inputs[r].value;if(o.indexOf("[]")===o.length-2?(-1===i.inArray(o,s)&&(a[o]=[]),a[o].push(v)):a[o]=v,"cf7msm-step"===o){if(-1!==v.indexOf("-")){c=!0,u=!1;var h=v.split("-");t=parseInt(h[0]),n=parseInt(h[1]),void 0!==cf7msm_redirect_urls[f]&&(d=cf7msm_redirect_urls[f]),t<n?p=!1:t===n&&(l=!0)}}else if("cf7msm_options"===o){c=!0,u=!0,p=!1;var w=JSON.parse(v);w.hasOwnProperty("next_url")&&(d=w.next_url),w.hasOwnProperty("last_step")&&(m=!0,d&&""!==d||(l=!0,p=!0))}else s.push(o)})),!c)return;if(!p){var v=i("#"+e.detail.unitTag).find("div.wpcf7-mail-sent-ok");0==v.length&&(v=i("#"+e.detail.unitTag).find(".wpcf7-response-output")),v.remove()}if(l){var h=i("#"+e.detail.unitTag+" form");h.find("*").not("div.wpcf7-response-output").hide(),h.find("div.wpcf7-response-output").parentsUntil("form").show()}if(u?m&&(r={}):0!=t&&t===n&&(r={}),d&&""!=d){var w={};r&&r.cf7msm_prev_urls&&(w=r.cf7msm_prev_urls);var _=window.location.protocol+"//"+window.location.host;0!==d.indexOf(_)&&(0!==d.indexOf("/")&&(_+="/"),d=_+d),w[d]=window.location.href;var g=d.split("?")[0];d!=g&&(w[g]=window.location.href),r.cf7msm_prev_urls=w}sessionStorage.setObject("cf7msm",r),d&&""!=d&&(window.location.href=d)}}),!1)}}),Storage.prototype.setObject=function(e,t){this.setItem(e,JSON.stringify(t))},Storage.prototype.getObject=function(e){var t=this.getItem(e);return t&&JSON.parse(t)}},8:function(e,t,n){}}));
|
1 |
+
!function(e,t){for(var n in t)e[n]=t[n]}(window,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}({6:function(e,t,n){e.exports=n(7)},7:function(e,t,n){"use strict";n.r(t);var r,i;n(8);function o(){try{return sessionStorage.setItem("test","test"),sessionStorage.removeItem("test"),!0}catch(e){return!1}}i=jQuery,document.addEventListener("DOMContentLoaded",e=>{var t=cf7msm_posted_data,n=i("input[name='_cf7msm_multistep_tag']"),s=n.length>0;if(s||(s=(n=i("input[name='cf7msm-step']")).length>0),s){var a=n.closest("form"),f=a.find('input[name="_wpcf7"]').val();o()?null!=(r=sessionStorage.getObject("cf7msm"))&&i.each(r,(function(e,t){if("cf7msm_prev_urls"==e){var n=a.find(".wpcf7-back, .wpcf7-previous"),r=window.location.href,i=r.replace(/\/$/,""),o=!t.hasOwnProperty(r)||""==t[r];o&&(o=!t.hasOwnProperty(i)||""==t[i]),o&&(r=r.split("?")[0],i=r.replace(/\/$/,""),(o=!t.hasOwnProperty(r)||""==t[r])&&(o=!t.hasOwnProperty(i)||""==t[i])),o?n.hide():n.click((function(e){t.hasOwnProperty(r)&&""!=t[r]?window.location.href=t[r]:t.hasOwnProperty(i)&&""!=t[i]?window.location.href=t[i]:window.history.go(-1),e.preventDefault()}))}})):(i("input[name='cf7msm-no-ss']").val(1),i(".wpcf7-previous").hide());var c=wpcf7.submit;wpcf7.submit=function(e,t){!function(e){!function(e){var t=e;t instanceof jQuery||(t=i(e));var n=t.find("input[name='_cf7msm_multistep_tag']");0!=n.length&&(n.length>1&&(n=n.last()),i("<input />",{type:"hidden",name:"cf7msm_options",value:n.val()}).appendTo(t))}(e)}(e),c(e,t)},window.addEventListener("load",(function(){t&&(i.each(t,(function(e,t){if(e.indexOf("[]")===e.length-2&&(e=e.substring(0,e.length-2)),(0!=e.indexOf("_")||0==e.indexOf("_wpcf7_radio_free_text_")||0==e.indexOf("_wpcf7_checkbox_free_text_"))&&"cf7msm-step"!=e&&"cf7msm_options"!=e){var n=a.find('*[name="'+e+'"]:not([data-cf7msm-previous])'),r=a.find('input[name="'+e+'[]"]:not([data-cf7msm-previous])'),o=a.find('select[name="'+e+'[]"]:not([data-cf7msm-previous])');n.length>0?"radio"==n.prop("type")||"checkbox"==n.prop("type")?n.filter((function(){return i(this).val()==t})).prop("checked",!0):n.is("select")?n.find("option").filter((function(){return this.value==t})).attr("selected","selected"):n.val(t):r.length>0&&t.constructor===Array?""!=t&&t.length>0&&i.each(t,(function(e,t){r.filter((function(){return i(this).val()==t})).prop("checked",!0)})):o.length>0&&t.constructor===Array&&""!=t&&t.length>0&&i.each(t,(function(e,t){o.find("option").filter((function(){return this.value==t})).attr("selected","selected")}))}})),a.find('input[name="_wpcf7cf_options"]').trigger("change"))})),document.addEventListener("wpcf7mailsent",(function(e){if(o()){var t=0,n=0,s=[],a={};(r=sessionStorage.getObject("cf7msm"))||(r={});var c=!1,u=!1,p=!0,l=!1,d=null,m=!1;if(i.each(e.detail.inputs,(function(r){var o=e.detail.inputs[r].name,v=e.detail.inputs[r].value;if(o.indexOf("[]")===o.length-2?(-1===i.inArray(o,s)&&(a[o]=[]),a[o].push(v)):a[o]=v,"cf7msm-step"===o){if(-1!==v.indexOf("-")){c=!0,u=!1;var h=v.split("-");t=parseInt(h[0]),n=parseInt(h[1]),void 0!==cf7msm_redirect_urls[f]&&(d=cf7msm_redirect_urls[f]),t<n?p=!1:t===n&&(l=!0)}}else if("cf7msm_options"===o){c=!0,u=!0,p=!1;var w=JSON.parse(v);w.hasOwnProperty("next_url")&&(d=w.next_url),w.hasOwnProperty("last_step")&&(m=!0,d&&""!==d||(l=!0,p=!0))}else s.push(o)})),!c)return;if(!p){var v=i("#"+e.detail.unitTag).find("div.wpcf7-mail-sent-ok");0==v.length&&(v=i("#"+e.detail.unitTag).find(".wpcf7-response-output")),v.remove()}if(l){var h=i("#"+e.detail.unitTag+" form");h.find("*").not("div.wpcf7-response-output").hide(),h.find("div.wpcf7-response-output").parentsUntil("form").show()}if(u?m&&(r={}):0!=t&&t===n&&(r={}),d&&""!=d){var w={};r&&r.cf7msm_prev_urls&&(w=r.cf7msm_prev_urls);var _=window.location.protocol+"//"+window.location.host;0!==d.indexOf(_)&&(0!==d.indexOf("/")&&(_+="/"),d=_+d),w[d]=window.location.href;var g=d.split("?")[0];d!=g&&(w[g]=window.location.href),r.cf7msm_prev_urls=w}sessionStorage.setObject("cf7msm",r),d&&""!=d&&(window.location.href=d)}}),!1)}}),Storage.prototype.setObject=function(e,t){this.setItem(e,JSON.stringify(t))},Storage.prototype.getObject=function(e){var t=this.getItem(e);return t&&JSON.parse(t)}},8:function(e,t,n){}}));
|