@alexsab-ru/scripts 0.10.0 → 0.11.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 +8 -0
- package/package.json +1 -1
package/lib/form.js
CHANGED
|
@@ -142,11 +142,19 @@ async function submitForm(form){
|
|
|
142
142
|
const btnText = btn.value || btn.innerText;
|
|
143
143
|
const agree = form.querySelector('[name="' + props.agreeSelector + '"]');
|
|
144
144
|
const phone = form.querySelector('[name="phone"]');
|
|
145
|
+
const dealer = form.querySelector('[name="dealer"]');
|
|
145
146
|
|
|
146
147
|
if (!phoneChecker(phone)) {
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
if(dealer && dealer.hasAttribute('required')){
|
|
152
|
+
if(!dealer.value){
|
|
153
|
+
showErrorMes(form, '.dealer', 'Выберите дилерский центр');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
150
158
|
if (props.validation && typeof props.validation === 'function') {
|
|
151
159
|
props.validation(form);
|
|
152
160
|
}
|