JS respects formnorequired
This commit is contained in:
parent
eb7f971d10
commit
62b708438c
@ -13,6 +13,7 @@
|
||||
|
||||
.alerts {
|
||||
top: 150px;
|
||||
bottom: auto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,12 @@
|
||||
if (requireds.length == 0) {
|
||||
return false;
|
||||
}
|
||||
if (typeof button.dataset.formnorequired !== 'undefined' && button.dataset.formnorequired !== null) {
|
||||
button.addEventListener('click', function() {
|
||||
form.submit();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
updateButtonState();
|
||||
|
||||
requireds.forEach(function(el) {
|
||||
@ -66,10 +72,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
var forms = document.querySelectorAll('form');
|
||||
Array.from(forms).forEach(function(form) {
|
||||
// auto reactiveButton submit-buttons with required fields
|
||||
var submitBtn = form.querySelector('[type=submit]');
|
||||
if (submitBtn) {
|
||||
var submitBtns = Array.from(form.querySelectorAll('[type=submit]'));
|
||||
submitBtns.forEach(function(submitBtn) {
|
||||
window.utils.reactiveButton(form, submitBtn, validateForm);
|
||||
}
|
||||
});
|
||||
|
||||
// auto conditonal fieldsets
|
||||
var fieldSets = Array.from(form.querySelectorAll('fieldset[data-conditional-id][data-conditional-value]'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user