Contact Form 7 Multi-Step Forms - Version 4.1.5

Version Description

  • fixed prev button not showing up when next url from previous form has a querystring in it.
  • fixed issue with cookie being set on non-multistep forms.
  • PRO: added compatibility for repeaters in Conditional Fields Pro.
Download this release

Release Info

Developer webheadllc
Plugin Icon 128x128 Contact Form 7 Multi-Step Forms
Version 4.1.5
Comparing to
See all releases

Code changes from version 4.1.4 to 4.1.5

cf7msm.php CHANGED
@@ -439,6 +439,9 @@ function cf7msm_store_data_steps()
439
  if ( $use_cookies ) {
440
  $cf7_posted_data = WPCF7_Submission::get_instance()->get_posted_data();
441
  $is_last_step = false;
 
 
 
442
 
443
  if ( !empty($cf7_posted_data['cf7msm_options']) ) {
444
  $options = json_decode( stripslashes( $cf7_posted_data['cf7msm_options'] ), true );
439
  if ( $use_cookies ) {
440
  $cf7_posted_data = WPCF7_Submission::get_instance()->get_posted_data();
441
  $is_last_step = false;
442
+ if ( empty($cf7_posted_data['cf7msm-step']) && empty($cf7_posted_data['cf7msm_options']) ) {
443
+ return;
444
+ }
445
 
446
  if ( !empty($cf7_posted_data['cf7msm_options']) ) {
447
  $options = json_decode( stripslashes( $cf7_posted_data['cf7msm_options'] ), true );
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.4
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.4' );
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.5
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.5' );
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
@@ -48,6 +48,16 @@ var cf7msm_ss;
48
  // also check w/o trailing slash since it's sometimes added in the url.
49
  maybeHideButton = (!val.hasOwnProperty(url_no_slash) || val[url_no_slash] == '' )
50
  }
 
 
 
 
 
 
 
 
 
 
51
  if (maybeHideButton) {
52
  backButton.hide();
53
  }
@@ -70,8 +80,6 @@ var cf7msm_ss;
70
  }
71
 
72
 
73
- /* Premium Code Stripped by Freemius */
74
-
75
  }
76
  else {
77
  $("input[name='cf7msm-no-ss']").val(1);
@@ -80,12 +88,8 @@ var cf7msm_ss;
80
 
81
  function cf7msm() {
82
 
83
- /* Premium Code Stripped by Freemius */
84
-
85
  if (posted_data) {
86
 
87
- /* Premium Code Stripped by Freemius */
88
-
89
  $.each(posted_data, function(key, val){
90
  if ( key.indexOf('[]') === key.length - 2 ) {
91
  key = key.substring(0, key.length - 2 );
@@ -112,8 +116,6 @@ var cf7msm_ss;
112
  }
113
 
114
 
115
- /* Premium Code Stripped by Freemius */
116
-
117
 
118
  else if ( checkbox_field.length > 0 && val.constructor === Array ) {
119
  //checkbox
@@ -137,14 +139,10 @@ var cf7msm_ss;
137
  }
138
 
139
 
140
- /* Premium Code Stripped by Freemius */
141
-
142
  }
143
  });
144
 
145
 
146
- /* Premium Code Stripped by Freemius */
147
-
148
  }
149
  }
150
 
@@ -156,8 +154,6 @@ var cf7msm_ss;
156
 
157
  function cf7msmBeforeSubmit( form ) {
158
 
159
- /* Premium Code Stripped by Freemius */
160
-
161
  cf7msmSetOptions( form );
162
  }
163
 
@@ -169,8 +165,6 @@ var cf7msm_ss;
169
 
170
  var cf7msm_option = form.find("input[name='_cf7msm_multistep_tag']");
171
 
172
- /* Premium Code Stripped by Freemius */
173
-
174
  if ( cf7msm_option.length == 0) {
175
  return;
176
  }
@@ -187,8 +181,6 @@ var cf7msm_ss;
187
 
188
 
189
 
190
- /* Premium Code Stripped by Freemius */
191
-
192
 
193
  window.addEventListener( 'load', function() {
194
  cf7msm();
@@ -313,8 +305,6 @@ var cf7msm_ss;
313
  }
314
 
315
 
316
- /* Premium Code Stripped by Freemius */
317
-
318
 
319
  if ( !hasMultistepOptions ) {
320
  if ( currStep != 0 && currStep === totalSteps ) {
@@ -338,6 +328,10 @@ var cf7msm_ss;
338
  nextUrl = startOfUrl + nextUrl;
339
  }
340
  steps_prev_urls[nextUrl] = window.location.href;
 
 
 
 
341
  cf7msm_ss.cf7msm_prev_urls = steps_prev_urls;
342
  }
343
 
@@ -348,8 +342,6 @@ var cf7msm_ss;
348
  }
349
 
350
 
351
- /* Premium Code Stripped by Freemius */
352
-
353
  /*
354
  if ( currStep != 0 && currStep === totalSteps ) {
355
  cf7msm_ss = {};
48
  // also check w/o trailing slash since it's sometimes added in the url.
49
  maybeHideButton = (!val.hasOwnProperty(url_no_slash) || val[url_no_slash] == '' )
50
  }
51
+ // try again without the querystring
52
+ if (maybeHideButton) {
53
+ url = url.split('?')[0];
54
+ url_no_slash = url.replace(/\/$/, ""); // w/o trailing slash
55
+ maybeHideButton = (!val.hasOwnProperty(url) || val[url] == '' );
56
+ if (maybeHideButton) {
57
+ // also check w/o trailing slash since it's sometimes added in the url.
58
+ maybeHideButton = (!val.hasOwnProperty(url_no_slash) || val[url_no_slash] == '' )
59
+ }
60
+ }
61
  if (maybeHideButton) {
62
  backButton.hide();
63
  }
80
  }
81
 
82
 
 
 
83
  }
84
  else {
85
  $("input[name='cf7msm-no-ss']").val(1);
88
 
89
  function cf7msm() {
90
 
 
 
91
  if (posted_data) {
92
 
 
 
93
  $.each(posted_data, function(key, val){
94
  if ( key.indexOf('[]') === key.length - 2 ) {
95
  key = key.substring(0, key.length - 2 );
116
  }
117
 
118
 
 
 
119
 
120
  else if ( checkbox_field.length > 0 && val.constructor === Array ) {
121
  //checkbox
139
  }
140
 
141
 
 
 
142
  }
143
  });
144
 
145
 
 
 
146
  }
147
  }
148
 
154
 
155
  function cf7msmBeforeSubmit( form ) {
156
 
 
 
157
  cf7msmSetOptions( form );
158
  }
159
 
165
 
166
  var cf7msm_option = form.find("input[name='_cf7msm_multistep_tag']");
167
 
 
 
168
  if ( cf7msm_option.length == 0) {
169
  return;
170
  }
181
 
182
 
183
 
 
 
184
 
185
  window.addEventListener( 'load', function() {
186
  cf7msm();
305
  }
306
 
307
 
 
 
308
 
309
  if ( !hasMultistepOptions ) {
310
  if ( currStep != 0 && currStep === totalSteps ) {
328
  nextUrl = startOfUrl + nextUrl;
329
  }
330
  steps_prev_urls[nextUrl] = window.location.href;
331
+ var without_query = nextUrl.split('?')[0];
332
+ if (nextUrl != without_query) {
333
+ steps_prev_urls[without_query] = window.location.href;
334
+ }
335
  cf7msm_ss.cf7msm_prev_urls = steps_prev_urls;
336
  }
337
 
342
  }
343
 
344
 
 
 
345
  /*
346
  if ( currStep != 0 && currStep === totalSteps ) {
347
  cf7msm_ss = {};
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.6
7
- Stable tag: 4.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -135,6 +135,11 @@ When checkboxes are not checked they aren't submitted through the form so the la
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
138
  = 4.1.4 =
139
  * fixed error when caching is enabled.
140
 
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
7
+ Stable tag: 4.1.5
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.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.
141
+ * PRO: added compatibility for repeaters in Conditional Fields Pro.
142
+
143
  = 4.1.4 =
144
  * fixed error when caching is enabled.
145
 
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 f=n.closest("form"),a=f.find('input[name="_wpcf7"]').val();o()?null!=(r=sessionStorage.getObject("cf7msm"))&&i.each(r,(function(e,t){if("cf7msm_prev_urls"==e){var n=f.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?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=f.find('*[name="'+e+'"]:not([data-cf7msm-previous])'),r=f.find('input[name="'+e+'[]"]:not([data-cf7msm-previous])'),o=f.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=[],f={};(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)&&(f[o]=[]),f[o].push(v)):f[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[a]&&(d=cf7msm_redirect_urls[a]),t<n?p=!1:t===n&&(l=!0)}}else if("cf7msm_options"===o){c=!0,u=!0,p=!1;var _=JSON.parse(v);_.hasOwnProperty("next_url")&&(d=_.next_url),_.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 _={};r&&r.cf7msm_prev_urls&&(_=r.cf7msm_prev_urls);var w=window.location.protocol+"//"+window.location.host;0!==d.indexOf(w)&&(0!==d.indexOf("/")&&(w+="/"),d=w+d),_[d]=window.location.href,r.cf7msm_prev_urls=_}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")}))}}))})),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){}}));