@alexsab-ru/scripts 0.8.5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/form.js +10 -8
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -78,10 +78,10 @@ const showMessageModal = (messageModal, icon, message) => {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
const propsParams = {
|
|
81
|
-
callback: null,
|
|
82
|
-
callback_error: null,
|
|
81
|
+
callback: null,
|
|
82
|
+
callback_error: null,
|
|
83
83
|
validation: null,
|
|
84
|
-
ct_routeKey: '',
|
|
84
|
+
ct_routeKey: '',
|
|
85
85
|
confirmModalText: '',
|
|
86
86
|
verbose: false,
|
|
87
87
|
agreeSelector: "agree",
|
|
@@ -96,7 +96,7 @@ export const connectForms = (url, props = propsParams) => {
|
|
|
96
96
|
element.addEventListener("input", maskphone);
|
|
97
97
|
element.addEventListener("change", () => phoneChecker(element));
|
|
98
98
|
});
|
|
99
|
-
|
|
99
|
+
|
|
100
100
|
// AGREE CHECKBOX
|
|
101
101
|
// Проверка на состояние чекбокса, показ/скрытие ошибки
|
|
102
102
|
document.querySelectorAll("input[name=" + props.agreeSelector + "]").forEach(function (element) {
|
|
@@ -109,7 +109,7 @@ export const connectForms = (url, props = propsParams) => {
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
});
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
// CHANGE textarea для всез браузеров
|
|
114
114
|
document.querySelectorAll("textarea").forEach(function (textarea) {
|
|
115
115
|
if (textarea.addEventListener) {
|
|
@@ -128,7 +128,7 @@ export const connectForms = (url, props = propsParams) => {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
async function submitForm(form){
|
|
133
133
|
const btn = form.querySelector('[type="submit"]');
|
|
134
134
|
const btnText = btn.value || btn.innerText;
|
|
@@ -247,8 +247,10 @@ async function submitForm(form){
|
|
|
247
247
|
}
|
|
248
248
|
return;
|
|
249
249
|
} else {
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
if(data.attention != true) {
|
|
251
|
+
reachGoal("form_success", formDataObj);
|
|
252
|
+
}
|
|
253
|
+
setCookie(sendMailCookie, true, {'domain': window.location.hostname,'path':'/','expires':600});
|
|
252
254
|
// Вызов callback при успехе
|
|
253
255
|
if (props.callback && typeof props.callback === 'function') {
|
|
254
256
|
props.callback(data);
|