Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentes Révision précédente | |||
| info:concrete5:59:formvalidation [2025/09/19 04:55] – supprimée - modification externe (Date inconnue) 127.0.0.1 | info:concrete5:59:formvalidation [2025/09/19 04:55] (Version actuelle) – ↷ Page déplacée de info:concrete5:58:formvalidation à info:concrete5:59:formvalidation radeff | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | ====== Form validation single pages - valider vos formulaires scriptés avec Bootstrap / Jquery ====== | ||
| + | <note tip> | ||
| + | ===== Doc officielle Bootstrap ===== | ||
| + | https:// | ||
| + | ===== à ajouter au début du script ===== | ||
| + | <code js> | ||
| + | < | ||
| + | //jquery validate form script | ||
| + | $( document ).ready(function() { | ||
| + | (function () { | ||
| + | 'use strict' | ||
| + | // Fetch all the forms we want to apply custom Bootstrap validation styles to | ||
| + | var forms = document.querySelectorAll(' | ||
| + | // Loop over them and prevent submission | ||
| + | Array.prototype.slice.call(forms) | ||
| + | .forEach(function (form) { | ||
| + | form.addEventListener(' | ||
| + | if (!form.checkValidity()) { | ||
| + | event.preventDefault() | ||
| + | event.stopPropagation() | ||
| + | } | ||
| + | form.classList.add(' | ||
| + | }, false) | ||
| + | }) | ||
| + | })() | ||
| + | |||
| + | }); | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== dans le code php ===== | ||
| + | la classe // | ||
| + | <code php> | ||
| + | echo '< | ||
| + | ... | ||
| + | echo '< | ||
| + | <label class=" | ||
| + | <input type=" | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== Exemple de résultat ===== | ||
| + | "// | ||
| + | |||
| + | {{: | ||