From 3ea39841c8049525e31e9f4d6300f0c60cdb42de Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 24 Jan 2023 13:33:51 +0100 Subject: Adding upstream version 5.2.3+dfsg. Signed-off-by: Daniel Baumann --- site/static/docs/5.2/assets/js/validate-forms.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 site/static/docs/5.2/assets/js/validate-forms.js (limited to 'site/static/docs/5.2/assets/js/validate-forms.js') diff --git a/site/static/docs/5.2/assets/js/validate-forms.js b/site/static/docs/5.2/assets/js/validate-forms.js new file mode 100644 index 0000000..30ea0aa --- /dev/null +++ b/site/static/docs/5.2/assets/js/validate-forms.js @@ -0,0 +1,19 @@ +// Example starter JavaScript for disabling form submissions if there are invalid fields +(() => { + 'use strict' + + // 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) + }) +})() -- cgit v1.2.3