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

Version Description

  • Improvement: Fields with validation errors are now marked with a CSS class for easier styling.
  • Improvement: Browser autocompletion has been disabled everywhere for more consistent behavior.
  • Improvement: Forms now scroll to top only when partially out of the viewport.
  • Bugfix: "Add custom CSS classes to submit button" was misbehaving.
Download this release

Release Info

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

Code changes from version 1.12.11 to 1.12.12

core/assets/js/lib/happyforms-select.js CHANGED
@@ -152,7 +152,7 @@
152
  HappyFormsSelect.prototype.onItemSelect = function( e ) {
153
  e.stopPropagation();
154
 
155
- var $li = $( e.target );
156
 
157
  if ( 'undefined' !== typeof $li.attr( 'data-value' ) ) {
158
  this.setValue( $li.data('value').toString() );
152
  HappyFormsSelect.prototype.onItemSelect = function( e ) {
153
  e.stopPropagation();
154
 
155
+ var $li = $( e.currentTarget );
156
 
157
  if ( 'undefined' !== typeof $li.attr( 'data-value' ) ) {
158
  this.setValue( $li.data('value').toString() );
core/classes/class-form-controller.php CHANGED
@@ -52,6 +52,10 @@ class HappyForms_Form_Controller {
52
 
53
  add_action( 'happyforms_form_before', array( $this, 'render_title' ) );
54
  add_filter( 'happyforms_the_form_title', array( $this, 'the_form_title' ), 10, 4 );
 
 
 
 
55
  }
56
 
57
  /**
@@ -830,6 +834,29 @@ class HappyForms_Form_Controller {
830
  return $steps;
831
  }
832
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
833
  }
834
 
835
  if ( ! function_exists( 'happyforms_get_form_controller' ) ):
52
 
53
  add_action( 'happyforms_form_before', array( $this, 'render_title' ) );
54
  add_filter( 'happyforms_the_form_title', array( $this, 'the_form_title' ), 10, 4 );
55
+ add_filter( 'happyforms_part_class', array( $this, 'part_error_class' ), 10, 3 );
56
+
57
+ add_filter( 'happyforms_get_form_attributes', array( $this, 'set_form_autocomplete_off' ), 10, 1);
58
+ add_filter( 'happyforms_part_attributes', array( $this, 'set_parts_autocomplete_off' ), 10, 1);
59
  }
60
 
61
  /**
834
  return $steps;
835
  }
836
 
837
+ public function part_error_class( $classes, $part, $form ) {
838
+ $part_name = happyforms_get_part_name( $part, $form );
839
+ $notices = happyforms_get_session()->get_messages( $part_name );
840
+
841
+ if( ! empty( $notices ) ) {
842
+ $classes[] = 'happyforms-part__validation-failed';
843
+ }
844
+
845
+ return $classes;
846
+ }
847
+
848
+ public function set_form_autocomplete_off( $attrs ) {
849
+ $attrs['autocomplete'] = 'off';
850
+
851
+ return $attrs;
852
+ }
853
+
854
+ public function set_parts_autocomplete_off( $attrs ) {
855
+ $attrs[] = 'autocomplete="off"';
856
+
857
+ return $attrs;
858
+ }
859
+
860
  }
861
 
862
  if ( ! function_exists( 'happyforms_get_form_controller' ) ):
core/classes/class-form-setup.php CHANGED
@@ -114,8 +114,8 @@ class HappyForms_Form_Setup {
114
  'sanitize' => 'happyforms_sanitize_checkbox'
115
  ),
116
  'add_submit_button_class' => array(
117
- 'default' => '',
118
- 'sanitize' => 'sanitize_text_field'
119
  ),
120
  'submit_button_html_class' => array(
121
  'default' => '',
114
  'sanitize' => 'happyforms_sanitize_checkbox'
115
  ),
116
  'add_submit_button_class' => array(
117
+ 'default' => 0,
118
+ 'sanitize' => 'happyforms_sanitize_checkbox'
119
  ),
120
  'submit_button_html_class' => array(
121
  'default' => '',
core/helpers/helper-form-templates.php CHANGED
@@ -397,7 +397,7 @@ function happyforms_get_part_preview_value( $part, $form ) {
397
  $part_value = happyforms_get_part_value( $part, $form );
398
  $validated_value = $part_class->validate_value( $part_value, $part, $form );
399
  $value = happyforms_stringify_part_value( $validated_value, $part, $form );
400
- $value = happyforms_get_message_part_value( $value, $part );
401
 
402
  return $value;
403
  }
397
  $part_value = happyforms_get_part_value( $part, $form );
398
  $validated_value = $part_class->validate_value( $part_value, $part, $form );
399
  $value = happyforms_stringify_part_value( $validated_value, $part, $form );
400
+ $value = happyforms_get_message_part_value( $value, $part, 'preview' );
401
 
402
  return $value;
403
  }
core/templates/partials/happyforms-select.php CHANGED
@@ -1,7 +1,7 @@
1
  <ul class="happyforms-custom-select-dropdown">
2
  <li class="happyforms-custom-select-dropdown__placeholder" data-value="" data-label=""><?php echo $placeholder_value; ?></li>
3
  <?php foreach ( $options as $index => $option ) : ?>
4
- <li <?php echo ( isset( $option['id'] ) ) ? 'data-option-id="'. esc_attr( $option['id'] ) .'" ' : ''; ?>data-value="<?php echo ( isset( $option['value'] ) ) ? $option['value'] : $index; ?>" data-label="<?php echo esc_attr( $option['label'] ); ?>" class="happyforms-dropdown-item happyforms-custom-select-dropdown__item"><?php echo esc_attr( $option['label'] ); ?></li>
5
  <?php endforeach; ?>
6
  <?php if ( count( $options ) > 5 ) : ?>
7
  <li class="happyforms-custom-select-dropdown__not-found"><?php echo esc_attr( $form['no_results_label'] ); ?></li>
1
  <ul class="happyforms-custom-select-dropdown">
2
  <li class="happyforms-custom-select-dropdown__placeholder" data-value="" data-label=""><?php echo $placeholder_value; ?></li>
3
  <?php foreach ( $options as $index => $option ) : ?>
4
+ <li <?php echo ( isset( $option['id'] ) ) ? 'data-option-id="'. esc_attr( $option['id'] ) .'" ' : ''; ?>data-value="<?php echo ( isset( $option['value'] ) ) ? $option['value'] : $index; ?>" data-label="<?php echo esc_attr( $option['label'] ); ?>" class="happyforms-dropdown-item happyforms-custom-select-dropdown__item"><?php echo esc_attr( $option['label'] ); ?> <?php echo ( isset( $option['submissions_left_label'] ) ) ? $option['submissions_left_label'] : ''; ?></li>
5
  <?php endforeach; ?>
6
  <?php if ( count( $options ) > 5 ) : ?>
7
  <li class="happyforms-custom-select-dropdown__not-found"><?php echo esc_attr( $form['no_results_label'] ); ?></li>
happyforms.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://happyforms.io
6
  * Description: We're changin' WordPress forms.
7
  * Author: Happyforms
8
- * Version: 1.12.11
9
  * Author URI: https://happyforms.io
10
  * Upgrade URI: https://happyforms.io/upgrade
11
  */
@@ -13,7 +13,7 @@
13
  /**
14
  * The current version of the plugin.
15
  */
16
- define( 'HAPPYFORMS_VERSION', '1.12.11' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
5
  * Plugin URI: https://happyforms.io
6
  * Description: We're changin' WordPress forms.
7
  * Author: Happyforms
8
+ * Version: 1.12.12
9
  * Author URI: https://happyforms.io
10
  * Upgrade URI: https://happyforms.io/upgrade
11
  */
13
  /**
14
  * The current version of the plugin.
15
  */
16
+ define( 'HAPPYFORMS_VERSION', '1.12.12' );
17
 
18
  if ( ! function_exists( 'happyforms_plugin_file' ) ):
19
  /**
inc/assets/js/frontend.js CHANGED
@@ -357,22 +357,26 @@
357
  return;
358
  }
359
 
360
- var elTopOffset = this.$el.offset().top;
361
- var $notices = $( '.happyforms-message-notices', this.$el );
362
 
363
- if ( $form.is( '.happyforms-form--notices-below' ) && $notices.length ) {
364
- elTopOffset = $notices.offset().top;
365
- }
366
 
367
- // User filterable
368
- var increment = $form.attr( 'data-happyforms-scroll-offset' );
 
369
 
370
- if ( increment ) {
371
- increment = parseInt( increment, 10 );
372
- elTopOffset += increment;
373
- }
374
 
375
- this.$el.trigger( 'happyforms-scrolltop', elTopOffset );
 
 
 
 
 
 
376
 
377
  var hasErrorNotices = $( '.happyforms-message-notice.error', $form ).length;
378
 
357
  return;
358
  }
359
 
360
+ var elemCoordinates = this.$el.get( 0 ).getBoundingClientRect();
 
361
 
362
+ if( elemCoordinates.top < 0 ) {
363
+ var elTopOffset = this.$el.offset().top;
364
+ var $notices = $( '.happyforms-message-notices', this.$el );
365
 
366
+ if ( $form.is( '.happyforms-form--notices-below' ) && $notices.length ) {
367
+ elTopOffset = $notices.offset().top;
368
+ }
369
 
370
+ // User filterable
371
+ var increment = $form.attr( 'data-happyforms-scroll-offset' );
 
 
372
 
373
+ if ( increment ) {
374
+ increment = parseInt( increment, 10 );
375
+ elTopOffset += increment;
376
+ }
377
+
378
+ this.$el.trigger( 'happyforms-scrolltop', elTopOffset );
379
+ }
380
 
381
  var hasErrorNotices = $( '.happyforms-message-notice.error', $form ).length;
382
 
inc/classes/class-happyforms.php CHANGED
@@ -161,16 +161,28 @@ class HappyForms extends HappyForms_Core {
161
  'label' => __( 'Schedule visibility', 'happyforms' ),
162
  );
163
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  $controls[3200] = array(
165
  'type' => 'checkbox_dummy',
166
  'dummy_id' => 'block_emails',
167
- 'label' => __( 'Scan for the following email addresses, email domains and email partials', 'happyforms' ),
168
  );
169
 
170
  $controls[3201] = array(
171
  'type' => 'checkbox_dummy',
172
  'dummy_id' => 'block_language',
173
- 'label' => __( 'Scan for the following words, phrases and letters', 'happyforms' ),
174
  );
175
 
176
  return $controls;
161
  'label' => __( 'Schedule visibility', 'happyforms' ),
162
  );
163
 
164
+ $controls[3190] = array(
165
+ 'type' => 'checkbox_dummy',
166
+ 'dummy_id' => 'save_submissions',
167
+ 'label' => __( 'Store activity in database', 'happyforms' ),
168
+ );
169
+
170
+ $controls[3191] = array(
171
+ 'type' => 'checkbox_dummy',
172
+ 'dummy_id' => 'save_submissions',
173
+ 'label' => __( 'Capture user metadata (IP, language, platform, time and timezone)', 'happyforms' ),
174
+ );
175
+
176
  $controls[3200] = array(
177
  'type' => 'checkbox_dummy',
178
  'dummy_id' => 'block_emails',
179
+ 'label' => __( 'Block these email addresses, email domains and email partials', 'happyforms' ),
180
  );
181
 
182
  $controls[3201] = array(
183
  'type' => 'checkbox_dummy',
184
  'dummy_id' => 'block_language',
185
+ 'label' => __( 'Block these words, phrases and letters', 'happyforms' ),
186
  );
187
 
188
  return $controls;
languages/happyforms.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Happyforms (free) package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Happyforms (free) 1.12.11\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
- "POT-Creation-Date: 2021-07-05 08:27:32+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -13,7 +13,7 @@ msgstr ""
13
  "Language-Team: The Theme Foundry\n"
14
  "X-Generator: grunt-wp-i18n 0.4.9\n"
15
 
16
- #: core/classes/class-block.php:49 core/classes/class-form-controller.php:68
17
  #: core/classes/class-happyforms-core.php:166
18
  #: core/classes/class-happyforms-core.php:167
19
  #: core/classes/class-happyforms-widget.php:13 core/helpers/helper-misc.php:997
@@ -46,7 +46,7 @@ msgid "Delete Data and Deactivate Plugin"
46
  msgstr ""
47
 
48
  #: core/classes/class-form-admin.php:159
49
- #: core/classes/class-form-controller.php:74
50
  msgid "View form"
51
  msgstr ""
52
 
@@ -174,53 +174,53 @@ msgstr ""
174
  msgid "Undo"
175
  msgstr ""
176
 
177
- #: core/classes/class-form-controller.php:69
178
  msgid "Form"
179
  msgstr ""
180
 
181
- #: core/classes/class-form-controller.php:70
182
  #: core/classes/class-happyforms-core.php:182
183
  #: core/classes/class-happyforms-core.php:183
184
  msgid "Add New"
185
  msgstr ""
186
 
187
- #: core/classes/class-form-controller.php:71
188
- #: core/classes/class-form-controller.php:73
189
  msgid "Build form"
190
  msgstr ""
191
 
192
- #: core/classes/class-form-controller.php:72
193
  msgid "Edit form"
194
  msgstr ""
195
 
196
- #: core/classes/class-form-controller.php:75
197
  msgid "View forms"
198
  msgstr ""
199
 
200
- #: core/classes/class-form-controller.php:76
201
  msgid "Search Forms"
202
  msgstr ""
203
 
204
- #: core/classes/class-form-controller.php:77
205
  msgid "No forms found."
206
  msgstr ""
207
 
208
- #: core/classes/class-form-controller.php:78
209
  msgid "No forms found in Trash."
210
  msgstr ""
211
 
212
- #: core/classes/class-form-controller.php:79
213
- #: core/classes/class-form-controller.php:80
214
  #: core/classes/class-happyforms-core.php:174
215
  #: core/classes/class-happyforms-core.php:175
216
  msgid "All Forms"
217
  msgstr ""
218
 
219
- #: core/classes/class-form-controller.php:526
220
  msgid "(no title)"
221
  msgstr ""
222
 
223
- #: core/classes/class-form-controller.php:621
224
  msgid " Copy"
225
  msgstr ""
226
 
@@ -3247,34 +3247,42 @@ msgid "Schedule visibility"
3247
  msgstr ""
3248
 
3249
  #: inc/classes/class-happyforms.php:167
3250
- msgid "Scan for the following email addresses, email domains and email partials"
3251
  msgstr ""
3252
 
3253
  #: inc/classes/class-happyforms.php:173
3254
- msgid "Scan for the following words, phrases and letters"
 
 
 
 
3255
  msgstr ""
3256
 
3257
- #: inc/classes/class-happyforms.php:183
 
 
 
 
3258
  msgid "Include reply link"
3259
  msgstr ""
3260
 
3261
- #: inc/classes/class-happyforms.php:189
3262
  msgid "Include referral web address"
3263
  msgstr ""
3264
 
3265
- #: inc/classes/class-happyforms.php:195 inc/classes/class-happyforms.php:207
3266
  msgid "Attach .pdf"
3267
  msgstr ""
3268
 
3269
- #: inc/classes/class-happyforms.php:201
3270
  msgid "To email address"
3271
  msgstr ""
3272
 
3273
- #: inc/classes/class-happyforms.php:213
3274
  msgid "Send abandonment email"
3275
  msgstr ""
3276
 
3277
- #: inc/classes/class-happyforms.php:430 inc/classes/class-happyforms.php:448
3278
  msgid "Build your own WordPress form with Happyforms"
3279
  msgstr ""
3280
 
2
  # This file is distributed under the same license as the Happyforms (free) package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Happyforms (free) 1.12.12\n"
6
  "Report-Msgid-Bugs-To: https://thethemefoundry.com/support/\n"
7
+ "POT-Creation-Date: 2021-07-20 14:50:30+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
13
  "Language-Team: The Theme Foundry\n"
14
  "X-Generator: grunt-wp-i18n 0.4.9\n"
15
 
16
+ #: core/classes/class-block.php:49 core/classes/class-form-controller.php:72
17
  #: core/classes/class-happyforms-core.php:166
18
  #: core/classes/class-happyforms-core.php:167
19
  #: core/classes/class-happyforms-widget.php:13 core/helpers/helper-misc.php:997
46
  msgstr ""
47
 
48
  #: core/classes/class-form-admin.php:159
49
+ #: core/classes/class-form-controller.php:78
50
  msgid "View form"
51
  msgstr ""
52
 
174
  msgid "Undo"
175
  msgstr ""
176
 
177
+ #: core/classes/class-form-controller.php:73
178
  msgid "Form"
179
  msgstr ""
180
 
181
+ #: core/classes/class-form-controller.php:74
182
  #: core/classes/class-happyforms-core.php:182
183
  #: core/classes/class-happyforms-core.php:183
184
  msgid "Add New"
185
  msgstr ""
186
 
187
+ #: core/classes/class-form-controller.php:75
188
+ #: core/classes/class-form-controller.php:77
189
  msgid "Build form"
190
  msgstr ""
191
 
192
+ #: core/classes/class-form-controller.php:76
193
  msgid "Edit form"
194
  msgstr ""
195
 
196
+ #: core/classes/class-form-controller.php:79
197
  msgid "View forms"
198
  msgstr ""
199
 
200
+ #: core/classes/class-form-controller.php:80
201
  msgid "Search Forms"
202
  msgstr ""
203
 
204
+ #: core/classes/class-form-controller.php:81
205
  msgid "No forms found."
206
  msgstr ""
207
 
208
+ #: core/classes/class-form-controller.php:82
209
  msgid "No forms found in Trash."
210
  msgstr ""
211
 
212
+ #: core/classes/class-form-controller.php:83
213
+ #: core/classes/class-form-controller.php:84
214
  #: core/classes/class-happyforms-core.php:174
215
  #: core/classes/class-happyforms-core.php:175
216
  msgid "All Forms"
217
  msgstr ""
218
 
219
+ #: core/classes/class-form-controller.php:530
220
  msgid "(no title)"
221
  msgstr ""
222
 
223
+ #: core/classes/class-form-controller.php:625
224
  msgid " Copy"
225
  msgstr ""
226
 
3247
  msgstr ""
3248
 
3249
  #: inc/classes/class-happyforms.php:167
3250
+ msgid "Store activity in database"
3251
  msgstr ""
3252
 
3253
  #: inc/classes/class-happyforms.php:173
3254
+ msgid "Capture user metadata (IP, language, platform, time and timezone)"
3255
+ msgstr ""
3256
+
3257
+ #: inc/classes/class-happyforms.php:179
3258
+ msgid "Block these email addresses, email domains and email partials"
3259
  msgstr ""
3260
 
3261
+ #: inc/classes/class-happyforms.php:185
3262
+ msgid "Block these words, phrases and letters"
3263
+ msgstr ""
3264
+
3265
+ #: inc/classes/class-happyforms.php:195
3266
  msgid "Include reply link"
3267
  msgstr ""
3268
 
3269
+ #: inc/classes/class-happyforms.php:201
3270
  msgid "Include referral web address"
3271
  msgstr ""
3272
 
3273
+ #: inc/classes/class-happyforms.php:207 inc/classes/class-happyforms.php:219
3274
  msgid "Attach .pdf"
3275
  msgstr ""
3276
 
3277
+ #: inc/classes/class-happyforms.php:213
3278
  msgid "To email address"
3279
  msgstr ""
3280
 
3281
+ #: inc/classes/class-happyforms.php:225
3282
  msgid "Send abandonment email"
3283
  msgstr ""
3284
 
3285
+ #: inc/classes/class-happyforms.php:442 inc/classes/class-happyforms.php:460
3286
  msgid "Build your own WordPress form with Happyforms"
3287
  msgstr ""
3288
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: contact form, contact form plugin, forms, form builder, custom form, intak
5
  Requires at least: 4.8
6
  Tested up to: 5.7.2
7
  Requires PHP: 5.3
8
- Stable tag: 1.12.11
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -151,6 +151,12 @@ Aw, honestly, the thought that you're writing about our contact form builder is
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
154
  = 1.12.11 =
155
  * Improvement: Deactivation popup allows for keeping or deleting saved data.
156
  * Improvement: Forms block now supports additional CSS classes.
@@ -827,6 +833,9 @@ Aw, honestly, the thought that you're writing about our contact form builder is
827
 
828
  == Upgrade Notice ==
829
 
 
 
 
830
  = 1.12.11 =
831
  * Miscellaneous improvements and bugfixes.
832
 
5
  Requires at least: 4.8
6
  Tested up to: 5.7.2
7
  Requires PHP: 5.3
8
+ Stable tag: 1.12.12
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
151
 
152
  == Changelog ==
153
 
154
+ = 1.12.12 =
155
+ * Improvement: Fields with validation errors are now marked with a CSS class for easier styling.
156
+ * Improvement: Browser autocompletion has been disabled everywhere for more consistent behavior.
157
+ * Improvement: Forms now scroll to top only when partially out of the viewport.
158
+ * Bugfix: "Add custom CSS classes to submit button" was misbehaving.
159
+
160
  = 1.12.11 =
161
  * Improvement: Deactivation popup allows for keeping or deleting saved data.
162
  * Improvement: Forms block now supports additional CSS classes.
833
 
834
  == Upgrade Notice ==
835
 
836
+ = 1.12.12 =
837
+ * Miscellaneous improvements and bugfixes.
838
+
839
  = 1.12.11 =
840
  * Miscellaneous improvements and bugfixes.
841