Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms - Version 1.6.5

Version Description

  • Bugfix: Dropdown part was not displaying correct values when containing options with numeric values.
  • Bugfix: Dropdown part was not submitting default value correctly.
  • Bugfix: Titles set to display as a placeholder were not adjusting their position when coming back to form using browser's back button.
Download this release

Release Info

Developer thethemefoundry
Plugin Icon 128x128 Form builder to get in touch with visitors, grow your email list and collect payments — Happyforms
Version 1.6.5
Comparing to
See all releases

Code changes from version 1.6.4 to 1.6.5

assets/js/frontend.js CHANGED
@@ -8,14 +8,16 @@
8
  this.$input = $( 'input, textarea, select', this.$el );
9
 
10
  this.$input.on( 'keyup change', this.triggerChange.bind( this ) );
11
- this.$input.on( 'blur', this.onBlur.bind( this ) );
 
 
12
  },
13
 
14
  getType: function() {
15
  return this.type;
16
  },
17
 
18
- onBlur: function() {
19
  if ( this.$el.is( '.happyforms-part--label-as_placeholder' ) ) {
20
  if ( this.isFilled() ) {
21
  this.$el.addClass( 'happyforms-part--filled' );
8
  this.$input = $( 'input, textarea, select', this.$el );
9
 
10
  this.$input.on( 'keyup change', this.triggerChange.bind( this ) );
11
+ this.$input.on( 'blur', this.adjustPlaceholder.bind( this ) );
12
+
13
+ this.adjustPlaceholder();
14
  },
15
 
16
  getType: function() {
17
  return this.type;
18
  },
19
 
20
+ adjustPlaceholder: function() {
21
  if ( this.$el.is( '.happyforms-part--label-as_placeholder' ) ) {
22
  if ( this.isFilled() ) {
23
  this.$el.addClass( 'happyforms-part--filled' );
assets/js/lib/happyforms-select.js CHANGED
@@ -33,7 +33,8 @@
33
  if ( $('li.default', this.$dropdown).length ) {
34
  var $defaultItem = $('li.default', this.$dropdown);
35
 
36
- this.defaultValue = ( $defaultItem.data('label') ) ? $defaultItem.data('label') : $defaultItem.data('value');
 
37
  }
38
 
39
  this.bindEvents();
@@ -132,9 +133,9 @@
132
  $( 'li', this.$dropdown ).each(function( i, li ) {
133
  var $li = $(li);
134
  var liValue = $li.data('value');
135
- var liLabel = ( $li.data('label') && $li.data('label').length ) ? $li.data('label') : '';
136
 
137
- if ( ( liValue.length || ! isNaN( parseInt( liValue, 10 ) ) ) && liValue.toString() === value || liLabel.toString() === value ) {
138
  self.$select.val(liValue);
139
 
140
  if ( liLabel ) {
@@ -149,7 +150,7 @@
149
  }
150
  });
151
  } else {
152
- self.$input.val(this.defaultValue);
153
  self.$select.val(this.defaultValue);
154
  }
155
 
33
  if ( $('li.default', this.$dropdown).length ) {
34
  var $defaultItem = $('li.default', this.$dropdown);
35
 
36
+ this.defaultValue = $defaultItem.data('value');
37
+ this.defaultLabel = $defaultItem.data('label');
38
  }
39
 
40
  this.bindEvents();
133
  $( 'li', this.$dropdown ).each(function( i, li ) {
134
  var $li = $(li);
135
  var liValue = $li.data('value');
136
+ var liLabel = ( $li.data('label') ) ? $li.data('label') : '';
137
 
138
+ if ( liValue.toString() === value ) {
139
  self.$select.val(liValue);
140
 
141
  if ( liLabel ) {
150
  }
151
  });
152
  } else {
153
+ self.$input.val(this.defaultLabel);
154
  self.$select.val(this.defaultValue);
155
  }
156
 
happyforms.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://happyforms.me
6
  * Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
7
  * Author: The Theme Foundry
8
- * Version: 1.6.4
9
  * Author URI: https://thethemefoundry.com
10
  * Upgrade URI: https://thethemefoundry.com
11
  */
@@ -13,7 +13,7 @@
13
  /**
14
  * The current version of the plugin.
15
  */
16
- define( 'HAPPYFORMS_VERSION', '1.6.4' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
5
  * Plugin URI: https://happyforms.me
6
  * Description: Your friendly drag and drop contact form builder for creating contact forms, lead generation forms, feedback forms, quote forms, survey forms and more!
7
  * Author: The Theme Foundry
8
+ * Version: 1.6.5
9
  * Author URI: https://thethemefoundry.com
10
  * Upgrade URI: https://thethemefoundry.com
11
  */
13
  /**
14
  * The current version of the plugin.
15
  */
16
+ define( 'HAPPYFORMS_VERSION', '1.6.5' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
inc/classes/parts/class-part-radio.php CHANGED
@@ -168,10 +168,14 @@ class HappyForms_Part_Radio extends HappyForms_Form_Part {
168
  }
169
 
170
  if ( '' !== $validated_value ) {
 
 
 
 
171
  $options = range( 0, count( $part['options'] ) - 1 );
172
 
173
  if ( ! in_array( $validated_value, $options ) ) {
174
- return new WP_Error( 'error', __( 'Radio values are not valid.', 'happyforms' ) );
175
  }
176
  }
177
 
168
  }
169
 
170
  if ( '' !== $validated_value ) {
171
+ if ( ! is_numeric( $validated_value ) ) {
172
+ return new WP_Error( 'error', __( 'Radio value is not valid.', 'happyforms' ) );
173
+ }
174
+
175
  $options = range( 0, count( $part['options'] ) - 1 );
176
 
177
  if ( ! in_array( $validated_value, $options ) ) {
178
+ return new WP_Error( 'error', __( 'Radio value is not valid.', 'happyforms' ) );
179
  }
180
  }
181
 
inc/classes/parts/class-part-select.php CHANGED
@@ -165,10 +165,14 @@ class HappyForms_Part_Select extends HappyForms_Form_Part {
165
  }
166
 
167
  if ( '' !== $validated_value ) {
 
 
 
 
168
  $options = range( 0, count( $part['options'] ) - 1 );
169
 
170
  if ( ! in_array( intval( $validated_value ), $options ) ) {
171
- return new WP_Error( 'error', __( 'Select values are not valid.', 'happyforms' ) );
172
  }
173
  }
174
 
165
  }
166
 
167
  if ( '' !== $validated_value ) {
168
+ if ( ! is_numeric( $validated_value ) ) {
169
+ return new WP_Error( 'error', __( 'Selected value is not valid.', 'happyforms' ) );
170
+ }
171
+
172
  $options = range( 0, count( $part['options'] ) - 1 );
173
 
174
  if ( ! in_array( intval( $validated_value ), $options ) ) {
175
+ return new WP_Error( 'error', __( 'Selected value is not valid.', 'happyforms' ) );
176
  }
177
  }
178
 
languages/happyforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: HappyForms 1.6.4\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2018-09-22 14:09:59+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -1113,9 +1113,9 @@ msgstr ""
1113
  msgid "For radio buttons allowing one selection."
1114
  msgstr ""
1115
 
1116
- #: inc/classes/parts/class-part-radio.php:174
1117
- #: inc/classes/parts/class-part-table.php:240
1118
- msgid "Radio values are not valid."
1119
  msgstr ""
1120
 
1121
  #: inc/classes/parts/class-part-rating.php:10
@@ -1176,8 +1176,9 @@ msgstr ""
1176
  msgid "For selecting one option from a long list. Default value adjustable."
1177
  msgstr ""
1178
 
1179
- #: inc/classes/parts/class-part-select.php:171
1180
- msgid "Select values are not valid."
 
1181
  msgstr ""
1182
 
1183
  #: inc/classes/parts/class-part-single-line-text.php:8
@@ -1196,6 +1197,10 @@ msgstr ""
1196
  msgid "For radios and checkboxes displaying in a grid of rows and columns."
1197
  msgstr ""
1198
 
 
 
 
 
1199
  #: inc/classes/parts/class-part-title.php:9
1200
  msgid "For displaying personal honorifics."
1201
  msgstr ""
2
  # This file is distributed under the same license as the HappyForms package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: HappyForms 1.6.5\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2018-09-25 14:31:50+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
1113
  msgid "For radio buttons allowing one selection."
1114
  msgstr ""
1115
 
1116
+ #: inc/classes/parts/class-part-radio.php:172
1117
+ #: inc/classes/parts/class-part-radio.php:178
1118
+ msgid "Radio value is not valid."
1119
  msgstr ""
1120
 
1121
  #: inc/classes/parts/class-part-rating.php:10
1176
  msgid "For selecting one option from a long list. Default value adjustable."
1177
  msgstr ""
1178
 
1179
+ #: inc/classes/parts/class-part-select.php:169
1180
+ #: inc/classes/parts/class-part-select.php:175
1181
+ msgid "Selected value is not valid."
1182
  msgstr ""
1183
 
1184
  #: inc/classes/parts/class-part-single-line-text.php:8
1197
  msgid "For radios and checkboxes displaying in a grid of rows and columns."
1198
  msgstr ""
1199
 
1200
+ #: inc/classes/parts/class-part-table.php:240
1201
+ msgid "Radio values are not valid."
1202
+ msgstr ""
1203
+
1204
  #: inc/classes/parts/class-part-title.php:9
1205
  msgid "For displaying personal honorifics."
1206
  msgstr ""
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: contact, contact form, email, feedback form, form, form builder, custom fo
5
  Requires at least: 4.8
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
- Stable tag: 1.6.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -79,6 +79,11 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
79
 
80
  == Changelog ==
81
 
 
 
 
 
 
82
  = 1.6.4 =
83
  * New feature: Responses can now be tagged with a unique incremental ID (think receipts).
84
  * New feature: Labels for Rating part options when using Smileys / Thumbs as Rating Visuals.
@@ -273,6 +278,9 @@ Absolutely! HappyForms gets out of the way and is designed to work with any them
273
 
274
  == Upgrade Notice ==
275
 
 
 
 
276
  = 1.6.4 =
277
  * Response unique IDs, Rating labels, part display improvements, new email filters, bugfixes.
278
 
5
  Requires at least: 4.8
6
  Tested up to: 4.9.7
7
  Requires PHP: 5.2.4
8
+ Stable tag: 1.6.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
79
 
80
  == Changelog ==
81
 
82
+ = 1.6.5 =
83
+ * Bugfix: Dropdown part was not displaying correct values when containing options with numeric values.
84
+ * Bugfix: Dropdown part was not submitting default value correctly.
85
+ * Bugfix: Titles set to display as a placeholder were not adjusting their position when coming back to form using browser's back button.
86
+
87
  = 1.6.4 =
88
  * New feature: Responses can now be tagged with a unique incremental ID (think receipts).
89
  * New feature: Labels for Rating part options when using Smileys / Thumbs as Rating Visuals.
278
 
279
  == Upgrade Notice ==
280
 
281
+ = 1.6.5 =
282
+ * Bugfixes.
283
+
284
  = 1.6.4 =
285
  * Response unique IDs, Rating labels, part display improvements, new email filters, bugfixes.
286