form-validation.init.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /******/ (function() { // webpackBootstrap
  2. var __webpack_exports__ = {};
  3. /*!****************************************************!*\
  4. !*** ./resources/js/pages/form-validation.init.js ***!
  5. \****************************************************/
  6. /*
  7. Template Name: Skote - Admin & Dashboard Template
  8. Author: Themesbrand
  9. Website: https://themesbrand.com/
  10. Contact: themesbrand@gmail.com
  11. File: Form validation Js File
  12. */
  13. // Example starter JavaScript for disabling form submissions if there are invalid fields
  14. (function () {
  15. 'use strict';
  16. window.addEventListener('load', function () {
  17. // Fetch all the forms we want to apply custom Bootstrap validation styles to
  18. var forms = document.getElementsByClassName('needs-validation'); // Loop over them and prevent submission
  19. var validation = Array.prototype.filter.call(forms, function (form) {
  20. form.addEventListener('submit', function (event) {
  21. if (form.checkValidity() === false) {
  22. event.preventDefault();
  23. event.stopPropagation();
  24. }
  25. form.classList.add('was-validated');
  26. }, false);
  27. });
  28. }, false);
  29. })(); // parsley validation
  30. $(document).ready(function () {
  31. $('.custom-validation').parsley();
  32. });
  33. /******/ })()
  34. ;