source: public/assets/js/examples/form-validator.js@ e78295c

Last change on this file since e78295c was 194a359, checked in by beratkjufliju <kufliju@…>, 3 years ago

added departments, edited users and added user settings

  • Property mode set to 100644
File size: 701 bytes
Line 
1(function () {
2 'use strict';
3 window.addEventListener('load', function () {
4 // Fetch all the forms we want to apply custom Bootstrap validation styles to
5 var forms = document.getElementsByClassName('needs-validation');
6 // Loop over them and prevent submission
7 var validation = Array.prototype.filter.call(forms, function (form) {
8 form.addEventListener('submit', function (event) {
9 if (form.checkValidity() === false) {
10 event.preventDefault();
11 event.stopPropagation();
12 }
13 form.classList.add('was-validated');
14 }, false);
15 });
16 }, false);
17})();
Note: See TracBrowser for help on using the repository browser.