Conditional Fields for Contact Form 7 - Version 0.2.6

Version Description

  • Fixed problems with exclusive checkboxes in IE (https://wordpress.org/support/topic/internet-explorer-conditional-exclusive-checkboxes/)
Download this release

Release Info

Developer Jules Colle
Plugin Icon 128x128 Conditional Fields for Contact Form 7
Version 0.2.6
Comparing to
See all releases

Code changes from version 0.2.5 to 0.2.6

contact-form-7-conditional-fields.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form 7 Conditional Fields
4
  Plugin URI: http://bdwm.be/
5
  Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
  Author: Jules Colle
7
- Version: 0.2.5
8
  Author URI: http://bdwm.be/
9
  */
10
 
4
  Plugin URI: http://bdwm.be/
5
  Description: Adds support for conditional fields to Contact Form 7. This plugin depends on Contact Form 7.
6
  Author: Jules Colle
7
+ Version: 0.2.6
8
  Author URI: http://bdwm.be/
9
  */
10
 
js/scripts.js CHANGED
@@ -66,8 +66,6 @@ var cf7signature_resized = 0; // for compatibility with contact-form-7-signature
66
  continue;
67
  }
68
 
69
- console.log(condition);
70
-
71
  if ($field.attr('type') == 'checkbox') {
72
  if (
73
  $field.is(':checked') && condition.operator == 'equals' && $field.val() == condition.if_value
@@ -94,6 +92,8 @@ var cf7signature_resized = 0; // for compatibility with contact-form-7-signature
94
  }
95
  });
96
 
 
 
97
  if (condition.operator == 'equals' && $.inArray(condition.if_value, checked_values) != -1) {
98
  $('#'+unit_tag+' #'+condition.then_field).show();
99
  } else if (condition.operator == 'not equals' && $.inArray(condition.if_value, all_values) != -1 && $.inArray(condition.if_value, checked_values) == -1) {
@@ -109,6 +109,7 @@ var cf7signature_resized = 0; // for compatibility with contact-form-7-signature
109
  var conditions = options[i]['conditions'];
110
  display_fields(unit_tag, conditions);
111
  $('#'+unit_tag+' input, #'+unit_tag+' select, #'+unit_tag+' textarea').change({unit_tag:unit_tag, conditions:conditions}, function(e) {
 
112
  display_fields(e.data.unit_tag, e.data.conditions);
113
  });
114
  }
@@ -160,4 +161,14 @@ var cf7signature_resized = 0; // for compatibility with contact-form-7-signature
160
  }
161
  });
162
 
 
 
 
 
 
 
 
 
 
 
163
  })( jQuery );
66
  continue;
67
  }
68
 
 
 
69
  if ($field.attr('type') == 'checkbox') {
70
  if (
71
  $field.is(':checked') && condition.operator == 'equals' && $field.val() == condition.if_value
92
  }
93
  });
94
 
95
+
96
+
97
  if (condition.operator == 'equals' && $.inArray(condition.if_value, checked_values) != -1) {
98
  $('#'+unit_tag+' #'+condition.then_field).show();
99
  } else if (condition.operator == 'not equals' && $.inArray(condition.if_value, all_values) != -1 && $.inArray(condition.if_value, checked_values) == -1) {
109
  var conditions = options[i]['conditions'];
110
  display_fields(unit_tag, conditions);
111
  $('#'+unit_tag+' input, #'+unit_tag+' select, #'+unit_tag+' textarea').change({unit_tag:unit_tag, conditions:conditions}, function(e) {
112
+ console.log('change');
113
  display_fields(e.data.unit_tag, e.data.conditions);
114
  });
115
  }
161
  }
162
  });
163
 
164
+ // fix for exclusive checkboxes in IE (this will call the change-event again after all other checkboxes are unchecked, triggering the display_fields() function)
165
+ var old_wpcf7ExclusiveCheckbox = $.fn.wpcf7ExclusiveCheckbox;
166
+ $.fn.wpcf7ExclusiveCheckbox = function() {
167
+ return this.find('input:checkbox').click(function() {
168
+ var name = $(this).attr('name');
169
+ console.log('new func');
170
+ $(this).closest('form').find('input:checkbox[name="' + name + '"]').not(this).prop('checked', false).eq(0).change();
171
+ });
172
+ };
173
+
174
  })( jQuery );
readme.txt CHANGED
@@ -6,7 +6,7 @@ Website: http://bdwm.be
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 4.7
9
- Stable tag: 0.2.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -47,6 +47,9 @@ Because no questions have been asked frequently about this plugin.
47
 
48
  == Changelog ==
49
 
 
 
 
50
  = 0.2.5 =
51
  * Changed deprecated function wpcf7_add_shortcode to wpcf7_add_form_tag as it was causing errors in debug mode. (https://wordpress.org/support/topic/wpcf7_add_shortcode-deprecated-notice-2/)
52
  * Removed the hide option and fixed the not-equals option for single checkboxes
6
  Tags: wordpress, contact form 7, forms, conditional fields
7
  Requires at least: 4.1
8
  Tested up to: 4.7
9
+ Stable tag: 0.2.6
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
47
 
48
  == Changelog ==
49
 
50
+ = 0.2.6 =
51
+ * Fixed problems with exclusive checkboxes in IE (https://wordpress.org/support/topic/internet-explorer-conditional-exclusive-checkboxes/)
52
+
53
  = 0.2.5 =
54
  * Changed deprecated function wpcf7_add_shortcode to wpcf7_add_form_tag as it was causing errors in debug mode. (https://wordpress.org/support/topic/wpcf7_add_shortcode-deprecated-notice-2/)
55
  * Removed the hide option and fixed the not-equals option for single checkboxes