Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/aimogen-pro/scripts/bulk.js

Keine Baseline-Datei – Diff nur gegen leer.
Zur Liste
1
2 + "use strict";
3 + jQuery(document).ready(function ($) {
4 + $('#myForm').find('input, select, textarea').on('invalid', function (event) {
5 + event.preventDefault();
6 + let $field = $(this);
7 + let fieldName = $('label[for="' + this.id + '"]').text() || this.name || 'Unnamed field';
8 + let errorMessage = '';
9 + if (this.validity.valueMissing) {
10 + errorMessage = `${fieldName} is required.`;
11 + } else if (this.validity.typeMismatch) {
12 + errorMessage = `${fieldName} has an incorrect format.`;
13 + } else if (this.validity.rangeOverflow) {
14 + errorMessage = `${fieldName} exceeds the max value (${this.max}).`;
15 + } else if (this.validity.rangeUnderflow) {
16 + errorMessage = `${fieldName} is below the min value (${this.min}).`;
17 + } else if (this.validity.patternMismatch) {
18 + errorMessage = `${fieldName} does not match the required pattern.`;
19 + } else if (this.validity.stepMismatch) {
20 + errorMessage = `${fieldName} has an invalid step value.`;
21 + } else {
22 + errorMessage = `${fieldName} has an invalid value.`;
23 + }
24 + let $hiddenParent = $field.closest('.hidden, [style*="display: none"], [style*="visibility: hidden"]');
25 + if ($hiddenParent.length) {
26 + $hiddenParent.show();
27 + $field.show().addClass('aiomatic-highlight-error');
28 + }
29 + alert(errorMessage);
30 + $field.focus();
31 + });
32 + $('#myForm').on('submit', function (event) {
33 + let invalidFields = $(this).find(':invalid');
34 + if (invalidFields.length > 0) {
35 + event.preventDefault();
36 + }
37 + });
38 + });