Files
asset-management-system/resources/assets/js/validation.js
Arya Dwi Putra 5514f7de5b first commit
2025-12-01 06:41:22 +07:00

20 lines
605 B
JavaScript

(function(){
'use strict'
// Example starter JavaScript for disabling form submissions if there are invalid fields
// Fetch all the forms we want to apply custom Bootstrap validation styles to
const forms = document.querySelectorAll('.needs-validation')
/* Loop over them and prevent submission */
Array.from(forms).forEach(form => {
form.addEventListener('submit', event => {
if (!form.checkValidity()) {
event.preventDefault()
event.stopPropagation()
}
form.classList.add('was-validated')
}, false)
})
})();