PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 5.4.3
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v5.4.3
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | js/formidable.js +113 -281 6.5.25.4.3 View file →
@@ -16,9 +16,8 @@
16 16 *
17 17 * @since 5.4
18 18 */
19 19 function maybeAddPolyfills() {
20 - var i;
21 20 if ( ! Element.prototype.matches ) {
22 21 // IE9 supports matches but as msMatchesSelector instead.
23 22 Element.prototype.matches = Element.prototype.msMatchesSelector;
24 23 }
@@ -41,9 +40,9 @@
41 40 // NodeList.forEach().
42 41 if ( window.NodeList && ! NodeList.prototype.forEach ) {
43 42 NodeList.prototype.forEach = function( callback, thisArg ) {
44 43 thisArg = thisArg || window;
45 - for ( i = 0; i < this.length; i++ ) {
44 + for ( var i = 0; i < this.length; i++ ) {
46 45 callback.call( thisArg, this[ i ], i, this );
47 46 }
48 47 };
49 48 }
@@ -48,34 +47,8 @@
48 47 };
49 48 }
50 49 }
51 50
52 - /**
53 - * Triggers custom JS event.
54 - *
55 - * @since 5.5.3
56 - *
57 - * @param {HTMLElement} el The HTML element.
58 - * @param {String} eventName Event name.
59 - * @param {mixed} data The passed data.
60 - */
61 - function triggerCustomEvent( el, eventName, data ) {
62 - var event;
63 -
64 - if ( typeof window.CustomEvent === 'function' ) {
65 - event = new CustomEvent( eventName );
66 - } else if ( document.createEvent ) {
67 - event = document.createEvent( 'HTMLEvents' );
68 - event.initEvent( eventName, false, true );
69 - } else {
70 - return;
71 - }
72 -
73 - event.frmData = data;
74 -
75 - el.dispatchEvent( event );
76 - }
77 -
78 51 /* Get the ID of the field that changed*/
79 52 function getFieldId( field, fullID ) {
80 53 var nameParts, fieldId,
81 54 isRepeating = false,
@@ -162,9 +135,9 @@
162 135 *
163 136 * @since 2.03.02
164 137 *
165 138 * @param {object} $form
166 - */
139 + */
167 140 function disableSubmitButton( $form ) {
168 141 $form.find( 'input[type="submit"], input[type="button"], button[type="submit"]' ).attr( 'disabled', 'disabled' );
169 142 }
170 143
@@ -173,9 +146,9 @@
173 146 *
174 147 * @since 2.03.02
175 148 *
176 149 * @param {object} $form
177 - */
150 + */
178 151 function enableSubmitButton( $form ) {
179 152 $form.find( 'input[type="submit"], input[type="button"], button[type="submit"]' ).prop( 'disabled', false );
180 153 }
181 154
@@ -222,10 +195,23 @@
222 195 fields = jQuery( object ).find( 'input,select,textarea' );
223 196 if ( fields.length ) {
224 197 for ( n = 0, nl = fields.length; n < nl; n++ ) {
225 198 field = fields[n];
226 - if ( '' !== field.value ) {
227 - validateFieldValue( field, errors );
199 + value = field.value;
200 + if ( value !== '' ) {
201 + if ( field.type === 'hidden' ) {
202 + // don't validate
203 + } else if ( field.type === 'number' ) {
204 + errors = checkNumberField( field, errors );
205 + } else if ( field.type === 'email' ) {
206 + errors = checkEmailField( field, errors );
207 + } else if ( field.type === 'password' ) {
208 + errors = checkPasswordField( field, errors );
209 + } else if ( field.type === 'url' ) {
210 + errors = checkUrlField( field, errors );
211 + } else if ( field.pattern !== null ) {
212 + errors = checkPatternField( field, errors );
213 + }
228 214 }
229 215 }
230 216 }
231 217
@@ -272,9 +258,19 @@
272 258 errors = checkRequiredField( field, errors );
273 259 }
274 260
275 261 if ( errors.length < 1 ) {
276 - validateFieldValue( field, errors );
262 + if ( field.type === 'email' ) {
263 + errors = checkEmailField( field, errors );
264 + } else if ( field.type === 'password' ) {
265 + errors = checkPasswordField( field, errors );
266 + } else if ( field.type === 'number' ) {
267 + errors = checkNumberField( field, errors );
268 + } else if ( field.type === 'url' ) {
269 + errors = checkUrlField( field, errors );
270 + } else if ( field.pattern !== null ) {
271 + errors = checkPatternField( field, errors );
272 + }
277 273 }
278 274
279 275 removeFieldError( $fieldCont );
280 276 if ( Object.keys( errors ).length > 0 ) {
@@ -283,29 +279,8 @@
283 279 }
284 280 }
285 281 }
286 282
287 - function validateFieldValue( field, errors ) {
288 - if ( field.type === 'hidden' ) {
289 - // don't validate
290 - } else if ( field.type === 'number' ) {
291 - checkNumberField( field, errors );
292 - } else if ( field.type === 'email' ) {
293 - checkEmailField( field, errors );
294 - } else if ( field.type === 'password' ) {
295 - checkPasswordField( field, errors );
296 - } else if ( field.type === 'url' ) {
297 - checkUrlField( field, errors );
298 - } else if ( field.pattern !== null ) {
299 - checkPatternField( field, errors );
300 - }
301 -
302 - triggerCustomEvent( document, 'frm_validate_field_value', {
303 - field: field,
304 - errors: errors
305 - });
306 - }
307 -
308 283 function checkRequiredField( field, errors ) {
309 284 var checkGroup, tempVal, i, placeholder,
310 285 val = '',
311 286 fieldID = '',
@@ -421,8 +396,9 @@
421 396 if ( ! ( fieldID in errors ) ) {
422 397 errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
423 398 }
424 399 }
400 + return errors;
425 401 }
426 402
427 403 function checkEmailField( field, errors ) {
428 404 var fieldID = getFieldId( field, true ),
@@ -433,12 +409,14 @@
433 409 errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
434 410 }
435 411
436 412 confirmField( field, errors );
413 + return errors;
437 414 }
438 415
439 416 function checkPasswordField( field, errors ) {
440 417 confirmField( field, errors );
418 + return errors;
441 419 }
442 420
443 421 function confirmField( field, errors ) {
444 422 var value, confirmValue, firstField,
@@ -472,8 +450,9 @@
472 450 if ( ! ( fieldID in errors ) ) {
473 451 errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
474 452 }
475 453 }
454 + return errors;
476 455 }
477 456
478 457 function checkPatternField( field, errors ) {
479 458 var fieldID,
@@ -488,47 +467,11 @@
488 467 errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
489 468 }
490 469 }
491 470 }
471 + return errors;
492 472 }
493 473
494 - /**
495 - * Set color for select placeholders.
496 - *
497 - * @since 6.5.1
498 - */
499 - function setSelectPlaceholderColor() {
500 - var selects = document.querySelectorAll( '.form-field select' ),
501 - styleElement = document.querySelector( '.with_frm_style' ),
502 - textColorDisabled = styleElement ? getComputedStyle( styleElement ).getPropertyValue( '--text-color-disabled' ).trim() : '',
503 - changeSelectColor;
504 -
505 - // Exit if there are no select elements or the textColorDisabled property is missing
506 - if ( ! selects.length || ! textColorDisabled ) {
507 - return;
508 - }
509 -
510 - // Function to change the color of a select element
511 - changeSelectColor = function( select ) {
512 - if ( hasClass( select.options[select.selectedIndex], 'frm-select-placeholder' ) ) {
513 - select.style.setProperty( 'color', textColorDisabled, 'important' );
514 - } else {
515 - select.style.color = '';
516 - }
517 - };
518 -
519 - // Use a loop to iterate through each select element
520 - Array.prototype.forEach.call( selects, function( select ) {
521 - // Apply the color change to each select element
522 - changeSelectColor( select );
523 -
524 - // Add an event listener for future changes
525 - select.addEventListener( 'change', function() {
526 - changeSelectColor( select );
527 - });
528 - });
529 - }
530 -
531 474 function hasInvisibleRecaptcha( object ) {
532 475 var recaptcha, recaptchaID, alreadyChecked;
533 476
534 477 if ( isGoingToPrevPage( object ) ) {
@@ -613,9 +556,9 @@
613 556 return validate;
614 557 }
615 558
616 559 function getFormErrors( object, action ) {
617 - var fieldset, data, success, error, shouldTriggerEvent;
560 + var fieldset, data, success, error;
618 561
619 562 if ( typeof action === 'undefined' ) {
620 563 jQuery( object ).find( 'input[name="frm_action"]' ).val();
621 564 }
@@ -622,21 +565,14 @@
622 565
623 566 fieldset = jQuery( object ).find( '.frm_form_field' );
624 567 fieldset.addClass( 'frm_doing_ajax' );
625 568
626 - data = jQuery( object ).serialize() + '&action=frm_entries_' + action + '&nonce=' + frm_js.nonce; // eslint-disable-line camelcase
627 - shouldTriggerEvent = object.classList.contains( 'frm_trigger_event_on_submit' );
569 + data = jQuery( object ).serialize() + '&action=frm_entries_' + action + '&nonce=' + frm_js.nonce;
628 570
629 571 success = function( response ) {
630 - var defaultResponse, formID, replaceContent, pageOrder, formReturned, contSubmit, delay,
631 - $fieldCont, key, inCollapsedSection, frmTrigger, newTab;
632 -
633 - defaultResponse = {
634 - content: '',
635 - errors: {},
636 - pass: false
637 - };
638 -
572 + var formID, replaceContent, pageOrder, formReturned, contSubmit, delay,
573 + $fieldCont, key, inCollapsedSection, frmTrigger,
574 + defaultResponse = { 'content': '', 'errors': {}, 'pass': false };
639 575 if ( response === null ) {
640 576 response = defaultResponse;
641 577 }
642 578
@@ -647,41 +583,17 @@
647 583 response = defaultResponse;
648 584 }
649 585
650 586 if ( typeof response.redirect !== 'undefined' ) {
651 - if ( shouldTriggerEvent ) {
652 - triggerCustomEvent( object, 'frmSubmitEvent' );
653 - return;
654 - }
655 -
656 587 jQuery( document ).trigger( 'frmBeforeFormRedirect', [ object, response ]);
657 -
658 - if ( ! response.openInNewTab ) {
659 - // We return here because we're redirecting there is no need to update content.
660 - window.location = response.redirect;
661 - return;
662 - }
663 -
664 - // We don't return here because we're opening in a new tab, the old tab will still update.
665 - newTab = window.open( response.redirect, '_blank' );
666 - if ( ! newTab && response.fallbackMsg && response.content ) {
667 - response.content = response.content.trim().replace( /(<\/div><\/div>)$/, ' ' + response.fallbackMsg + '</div></div>' );
668 - }
669 - }
670 -
671 - if ( response.content !== '' ) {
588 + window.location = response.redirect;
589 + } else if ( response.content !== '' ) {
672 590 // the form or success message was returned
673 591
674 - if ( shouldTriggerEvent ) {
675 - triggerCustomEvent( object, 'frmSubmitEvent' );
676 - return;
677 - }
678 -
679 592 removeSubmitLoading( jQuery( object ) );
680 - if ( frm_js.offset != -1 ) { // eslint-disable-line camelcase
593 + if ( frm_js.offset != -1 ) {
681 594 frmFrontForm.scrollMsg( jQuery( object ), false );
682 595 }
683 -
684 596 formID = jQuery( object ).find( 'input[name="form_id"]' ).val();
685 597 response.content = response.content.replace( / frm_pro_form /g, ' frm_pro_form frm_no_hide ' );
686 598 replaceContent = jQuery( object ).closest( '.frm_forms' );
687 599 removeAddedScripts( replaceContent, formID );
@@ -718,8 +630,9 @@
718 630 delay
719 631 );
720 632 } else if ( Object.keys( response.errors ).length ) {
721 633 // errors were returned
634 +
722 635 removeSubmitLoading( jQuery( object ), 'enable' );
723 636
724 637 //show errors
725 638 contSubmit = true;
@@ -749,9 +662,9 @@
749 662 }
750 663 }
751 664 }
752 665
753 - jQuery( object ).find( '.frm-g-recaptcha, .g-recaptcha, .h-captcha' ).each( function() {
666 + jQuery( object ).find( '.frm-g-recaptcha, .g-recaptcha' ).each( function() {
754 667 var $recaptcha = jQuery( this ),
755 668 recaptchaID = $recaptcha.data( 'rid' );
756 669
757 670 if ( typeof grecaptcha !== 'undefined' && grecaptcha ) {
@@ -760,11 +673,8 @@
760 673 } else {
761 674 grecaptcha.reset();
762 675 }
763 676 }
764 - if ( typeof hcaptcha !== 'undefined' && hcaptcha ) {
765 - hcaptcha.reset();
766 - }
767 677 });
768 678
769 679 jQuery( document ).trigger( 'frmFormErrors', [ object, response ]);
770 680
@@ -796,9 +706,9 @@
796 706
797 707 function postToAjaxUrl( form, data, success, error ) {
798 708 var ajaxUrl, action, ajaxParams;
799 709
800 - ajaxUrl = frm_js.ajax_url; // eslint-disable-line camelcase
710 + ajaxUrl = frm_js.ajax_url;
801 711 action = form.getAttribute( 'action' );
802 712
803 713 if ( 'string' === typeof action && -1 !== action.indexOf( '?action=frm_forms_preview' ) ) {
804 714 ajaxUrl = action.split( '?action=frm_forms_preview' )[0];
@@ -899,9 +809,9 @@
899 809 $fieldCont.append(
900 810 jsErrors[key]
901 811 );
902 812 } else {
903 - roleString = frm_js.include_alert_role ? 'role="alert"' : ''; // eslint-disable-line camelcase
813 + roleString = frm_js.include_alert_role ? 'role="alert"' : '';
904 814 $fieldCont.append( '<div class="frm_error" ' + roleString + ' id="' + id + '">' + jsErrors[key] + '</div>' );
905 815 }
906 816
907 817 if ( typeof describedBy === 'undefined' ) {
@@ -1047,14 +957,14 @@
1047 957 label.append( '<span class="frm-wait"></span>' );
1048 958
1049 959 jQuery.ajax({
1050 960 type: 'POST',
1051 - url: frm_js.ajax_url, // eslint-disable-line camelcase
961 + url: frm_js.ajax_url,
1052 962 data: {
1053 963 action: 'frm_entries_send_email',
1054 964 entry_id: entryId,
1055 965 form_id: formId,
1056 - nonce: frm_js.nonce // eslint-disable-line camelcase
966 + nonce: frm_js.nonce
1057 967 },
1058 968 success: function( msg ) {
1059 969 var admin = document.getElementById( 'wpbody' );
1060 970 if ( admin === null ) {
@@ -1092,9 +1002,32 @@
1092 1002 /**********************************************
1093 1003 * Fallback functions
1094 1004 *********************************************/
1095 1005
1096 - function addTrimFallbackForIE() {
1006 + function addIndexOfFallbackForIE8() {
1007 + var len, from;
1008 +
1009 + if ( ! Array.prototype.indexOf ) {
1010 + Array.prototype.indexOf = function( elt /*, from*/ ) {
1011 + len = this.length >>> 0;
1012 +
1013 + from = Number( arguments[1]) || 0;
1014 + from = ( from < 0 ) ? Math.ceil( from ) : Math.floor( from );
1015 + if ( from < 0 ) {
1016 + from += len;
1017 + }
1018 +
1019 + for ( ; from < len; from++ ) {
1020 + if ( from in this && this[from] === elt ) {
1021 + return from;
1022 + }
1023 + }
1024 + return -1;
1025 + };
1026 + }
1027 + }
1028 +
1029 + function addTrimFallbackForIE8() {
1097 1030 if ( typeof String.prototype.trim !== 'function' ) {
1098 1031 String.prototype.trim = function() {
1099 1032 return this.replace( /^\s+|\s+$/g, '' );
1100 1033 };
@@ -1100,9 +1033,9 @@
1100 1033 };
1101 1034 }
1102 1035 }
1103 1036
1104 - function addFilterFallbackForIE() {
1037 + function addFilterFallbackForIE8() {
1105 1038 var t, len, res, thisp, i, val;
1106 1039
1107 1040 if ( ! Array.prototype.filter ) {
1108 1041
@@ -1133,8 +1066,26 @@
1133 1066 };
1134 1067 }
1135 1068 }
1136 1069
1070 + function addKeysFallbackForIE8() {
1071 + var keys, i;
1072 +
1073 + if ( ! Object.keys ) {
1074 + Object.keys = function( obj ) {
1075 + keys = [];
1076 +
1077 + for ( i in obj ) {
1078 + if ( obj.hasOwnProperty( i ) ) {
1079 + keys.push( i );
1080 + }
1081 + }
1082 +
1083 + return keys;
1084 + };
1085 + }
1086 + }
1087 +
1137 1088 /**
1138 1089 * Check for -webkit-box-shadow css value for input:-webkit-autofill selector.
1139 1090 * If this is a match, the User is autofilling the input on a Webkit browser.
1140 1091 * We want to delete the Honeypot field, otherwise it will get triggered as spam on autocomplete.
@@ -1145,37 +1096,8 @@
1145 1096 this.parentNode.removeChild( this );
1146 1097 }
1147 1098 }
1148 1099
1149 - function maybeMakeHoneypotFieldsUntabbable() {
1150 - document.addEventListener( 'keydown', handleKeyUp );
1151 -
1152 - function handleKeyUp( event ) {
1153 - var code;
1154 -
1155 - if ( 'undefined' !== typeof event.key ) {
1156 - code = event.key;
1157 - } else if ( 'undefined' !== typeof event.keyCode && 9 === event.keyCode ) {
1158 - code = 'Tab';
1159 - }
1160 -
1161 - if ( 'Tab' === code ) {
1162 - makeHoneypotFieldsUntabbable();
1163 - document.removeEventListener( 'keydown', handleKeyUp );
1164 - }
1165 - }
1166 -
1167 - function makeHoneypotFieldsUntabbable() {
1168 - document.querySelectorAll( '.frm_verify' ).forEach(
1169 - function( input ) {
1170 - if ( input.id && 0 === input.id.indexOf( 'frm_email_' ) ) {
1171 - input.setAttribute( 'tabindex', -1 );
1172 - }
1173 - }
1174 - );
1175 - }
1176 - }
1177 -
1178 1100 /**
1179 1101 * Focus on the first sub field when clicking to the primary label of combo field.
1180 1102 *
1181 1103 * @since 4.10.02
@@ -1180,11 +1102,11 @@
1180 1102 *
1181 1103 * @since 4.10.02
1182 1104 */
1183 1105 function changeFocusWhenClickComboFieldLabel() {
1184 - var label;
1106 + let label;
1185 1107
1186 - var comboInputsContainer = document.querySelectorAll( '.frm_combo_inputs_container' );
1108 + const comboInputsContainer = document.querySelectorAll( '.frm_combo_inputs_container' );
1187 1109 comboInputsContainer.forEach( function( inputsContainer ) {
1188 1110 if ( ! inputsContainer.closest( '.frm_form_field' ) ) {
1189 1111 return;
1190 1112 }
@@ -1202,9 +1124,9 @@
1202 1124
1203 1125 function checkForErrorsAndMaybeSetFocus() {
1204 1126 var errors, element, timeoutCallback;
1205 1127
1206 - if ( ! frm_js.focus_first_error ) { // eslint-disable-line camelcase
1128 + if ( ! frm_js.focus_first_error ) {
1207 1129 return;
1208 1130 }
1209 1131
1210 1132 errors = document.querySelectorAll( '.frm_form_field .frm_error' );
@@ -1272,9 +1194,9 @@
1272 1194 var target;
1273 1195
1274 1196 // loop parent nodes from the target to the delegation node.
1275 1197 for ( target = e.target; target && target != this; target = target.parentNode ) {
1276 - if ( target && target.matches && target.matches( selector ) ) {
1198 + if ( target.matches( selector ) ) {
1277 1199 handler.call( target, e );
1278 1200 break;
1279 1201 }
1280 1202 }
@@ -1396,87 +1318,8 @@
1396 1318 runOnLoad();
1397 1319 });
1398 1320 }
1399 1321
1400 - function shouldUpdateValidityMessage( target ) {
1401 - if ( 'INPUT' !== target.nodeName ) {
1402 - return false;
1403 - }
1404 -
1405 - if ( ! target.dataset.invmsg ) {
1406 - return false;
1407 - }
1408 -
1409 - if ( 'text' !== target.getAttribute( 'type' ) ) {
1410 - return false;
1411 - }
1412 -
1413 - if ( target.classList.contains( 'frm_verify' ) ) {
1414 - return false;
1415 - }
1416 -
1417 - return true;
1418 - }
1419 -
1420 - function maybeClearCustomValidityMessage( event, field ) {
1421 - var key,
1422 - isInvalid = false;
1423 -
1424 - if ( ! shouldUpdateValidityMessage( field ) ) {
1425 - return;
1426 - }
1427 -
1428 - for ( key in field.validity ) {
1429 - if ( 'customError' === key ) {
1430 - continue;
1431 - }
1432 - if ( 'valid' !== key && field.validity[ key ] === true ) {
1433 - isInvalid = true;
1434 - break;
1435 - }
1436 - };
1437 -
1438 - if ( ! isInvalid ) {
1439 - field.setCustomValidity( '' );
1440 - }
1441 - }
1442 -
1443 - function maybeShowNewTabFallbackMessage() {
1444 - var messageEl;
1445 -
1446 - if ( ! window.frmShowNewTabFallback ) {
1447 - return;
1448 - }
1449 -
1450 - messageEl = document.querySelector( '#frm_form_' + frmShowNewTabFallback.formId + '_container .frm_message' );
1451 - if ( ! messageEl ) {
1452 - return;
1453 - }
1454 -
1455 - messageEl.insertAdjacentHTML( 'beforeend', ' ' + frmShowNewTabFallback.message );
1456 - }
1457 -
1458 - function setCustomValidityMessage() {
1459 - var forms, length, index;
1460 -
1461 - forms = document.getElementsByClassName( 'frm-show-form' );
1462 - length = forms.length;
1463 -
1464 - for ( index = 0; index < length; ++index ) {
1465 - forms[ index ].addEventListener(
1466 - 'invalid',
1467 - function( event ) {
1468 - var target = event.target;
1469 -
1470 - if ( shouldUpdateValidityMessage( target ) ) {
1471 - target.setCustomValidity( target.dataset.invmsg );
1472 - }
1473 - },
1474 - true
1475 - );
1476 - }
1477 - }
1478 -
1479 1322 return {
1480 1323 init: function() {
1481 1324 maybeAddPolyfills();
1482 1325
@@ -1497,9 +1340,8 @@
1497 1340
1498 1341 jQuery( document ).on( 'change', '.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]', frmFrontForm.fieldValueChanged );
1499 1342
1500 1343 jQuery( document ).on( 'change', '[id^=frm_email_]', onHoneypotFieldChange );
1501 - maybeMakeHoneypotFieldsUntabbable();
1502 1344
1503 1345 jQuery( document ).on( 'click', 'a[data-frmconfirm]', confirmClick );
1504 1346 jQuery( 'a[data-frmtoggle]' ).on( 'click', toggleDiv );
1505 1347
@@ -1507,23 +1349,15 @@
1507 1349
1508 1350 // Focus on the first sub field when clicking to the primary label of combo field.
1509 1351 changeFocusWhenClickComboFieldLabel();
1510 1352
1511 - // Add fallbacks for IE.
1512 - addTrimFallbackForIE(); // Trim only works in IE10+.
1513 - addFilterFallbackForIE(); // Filter is not supported in any version of IE.
1353 + // Add fallbacks for the beloved IE8
1354 + addIndexOfFallbackForIE8();
1355 + addTrimFallbackForIE8();
1356 + addFilterFallbackForIE8();
1357 + addKeysFallbackForIE8();
1514 1358
1515 1359 initFloatingLabels();
1516 - maybeShowNewTabFallbackMessage();
1517 -
1518 - jQuery( document ).on( 'frmAfterAddRow', setCustomValidityMessage );
1519 - setCustomValidityMessage();
1520 - jQuery( document ).on( 'frmFieldChanged', maybeClearCustomValidityMessage );
1521 -
1522 - setSelectPlaceholderColor();
1523 -
1524 - // Elementor popup show event. Fix Elementor Popup && FF Captcha field conflicts
1525 - jQuery( document ).on( 'elementor/popup/show', frmRecaptcha );
1526 1360 },
1527 1361
1528 1362 getFieldId: function( field, fullID ) {
1529 1363 return getFieldId( field, fullID );
@@ -1706,12 +1540,12 @@
1706 1540 removeSubmitLoading: function( $object, enable, processesRunning ) {
1707 1541 removeSubmitLoading( $object, enable, processesRunning );
1708 1542 },
1709 1543
1710 - scrollToID: function( id ) {
1711 - var object = jQuery( document.getElementById( id ) );
1712 - frmFrontForm.scrollMsg( object, false );
1713 - },
1544 + scrollToID: function( id ) {
1545 + var object = jQuery( document.getElementById( id ) );
1546 + frmFrontForm.scrollMsg( object, false );
1547 + },
1714 1548
1715 1549 scrollMsg: function( id, object, animate ) {
1716 1550 var newPos, m, b, screenTop, screenBottom,
1717 1551 scrollObj = '';
@@ -1727,12 +1561,12 @@
1727 1561 }
1728 1562
1729 1563 jQuery( scrollObj ).trigger( 'focus' );
1730 1564 newPos = scrollObj.offset().top;
1731 - if ( ! newPos || frm_js.offset === '-1' ) { // eslint-disable-line camelcase
1565 + if ( ! newPos || frm_js.offset === '-1' ) {
1732 1566 return;
1733 1567 }
1734 - newPos = newPos - frm_js.offset; // eslint-disable-line camelcase
1568 + newPos = newPos - frm_js.offset;
1735 1569
1736 1570 m = jQuery( 'html' ).css( 'margin-top' );
1737 1571 b = jQuery( 'body' ).css( 'margin-top' );
1738 1572 if ( m || b ) {
@@ -1835,11 +1669,9 @@
1835 1669 },
1836 1670
1837 1671 visible: function( classes ) {
1838 1672 jQuery( classes ).css( 'visibility', 'visible' );
1839 - },
1840 -
1841 - triggerCustomEvent: triggerCustomEvent
1673 + }
1842 1674 };
1843 1675 }
1844 1676 frmFrontForm = frmFrontFormJS();
1845 1677
@@ -1862,15 +1694,15 @@
1862 1694 function frmUpdateField( entryId, fieldId, value, message, num ) {
1863 1695 jQuery( document.getElementById( 'frm_update_field_' + entryId + '_' + fieldId + '_' + num ) ).html( '<span class="frm-loading-img"></span>' );
1864 1696 jQuery.ajax({
1865 1697 type: 'POST',
1866 - url: frm_js.ajax_url, // eslint-disable-line camelcase
1698 + url: frm_js.ajax_url,
1867 1699 data: {
1868 1700 action: 'frm_entries_update_field_ajax',
1869 1701 entry_id: entryId,
1870 1702 field_id: fieldId,
1871 1703 value: value,
1872 - nonce: frm_js.nonce // eslint-disable-line camelcase
1704 + nonce: frm_js.nonce
1873 1705 },
1874 1706 success: function() {
1875 1707 if ( message.replace( /^\s+|\s+$/g, '' ) === '' ) {
1876 1708 jQuery( document.getElementById( 'frm_update_field_' + entryId + '_' + fieldId + '_' + num ) ).fadeOut( 'slow' );
@@ -1885,13 +1717,13 @@
1885 1717 console.warn( 'DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry' );
1886 1718 jQuery( document.getElementById( 'frm_delete_' + entryId ) ).replaceWith( '<span class="frm-loading-img" id="frm_delete_' + entryId + '"></span>' );
1887 1719 jQuery.ajax({
1888 1720 type: 'POST',
1889 - url: frm_js.ajax_url, // eslint-disable-line camelcase
1721 + url: frm_js.ajax_url,
1890 1722 data: {
1891 1723 action: 'frm_entries_destroy',
1892 1724 entry: entryId,
1893 - nonce: frm_js.nonce // eslint-disable-line camelcase
1725 + nonce: frm_js.nonce
1894 1726 },
1895 1727 success: function( html ) {
1896 1728 if ( html.replace( /^\s+|\s+$/g, '' ) === 'success' ) {
1897 1729 jQuery( document.getElementById( prefix + entryId ) ).fadeOut( 'slow' );
@@ -1912,14 +1744,14 @@
1912 1744 console.warn( 'DEPRECATED: function frm_resend_email in v2.0' );
1913 1745 $link.append( '<span class="spinner" style="display:inline"></span>' );
1914 1746 jQuery.ajax({
1915 1747 type: 'POST',
1916 - url: frm_js.ajax_url, // eslint-disable-line camelcase
1748 + url: frm_js.ajax_url,
1917 1749 data: {
1918 1750 action: 'frm_entries_send_email',
1919 1751 entry_id: entryId,
1920 1752 form_id: formId,
1921 - nonce: frm_js.nonce // eslint-disable-line camelcase
1753 + nonce: frm_js.nonce
1922 1754 },
1923 1755 success: function( msg ) {
1924 1756 $link.replaceWith( msg );
1925 1757 }