Sha256: dfdfc47b85e4fbd17c302f43a8c3b8cc2db41d6188b6ab45beda705e6d82ccc5

Contents?: true

Size: 616 Bytes

Versions: 26

Compression:

Stored size: 616 Bytes

Contents

// Example starter JavaScript for disabling form submissions if there are invalid fields
(function () {
  'use strict'

  // Fetch all the forms we want to apply custom Bootstrap validation styles to
  var forms = document.querySelectorAll('.needs-validation')

  // Loop over them and prevent submission
  Array.prototype.slice.call(forms)
    .forEach(function (form) {
      form.addEventListener('submit', function (event) {
        if (!form.checkValidity()) {
          event.preventDefault()
          event.stopPropagation()
        }

        form.classList.add('was-validated')
      }, false)
    })
})()

Version data entries

26 entries across 13 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.18.1 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.18.1 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.18.0 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.18.0 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.17.0 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.17.0 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.16.0 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.16.0 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.15.6 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.15.6 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.15.5 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.15.5 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.15.4 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.15.4 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.15.3 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.15.3 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.15.1.2 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js
card-mod-bootstrap-0.15.1.2 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.15.2.pre1 vendor/bootstrap/site/static/docs/5.1/assets/js/validate-forms.js
card-mod-bootstrap-0.15.2.pre1 vendor/bootstrap/site/content/docs/5.1/examples/checkout/form-validation.js