Na most egy validator is beköszönt

This commit is contained in:
2025-03-17 15:01:50 +01:00
parent 8c1e60889d
commit b8fcdd5c3d
9 changed files with 73 additions and 4 deletions
@@ -44,8 +44,8 @@
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
var formData = getFormAsNestedObject('#UserForm');
const $form = $('#UserForm');
console.log($form);
if ($form[0].checkValidity())
if ($form.valid())
{
$.ajax({
url: $('#UserEditPostUrl').val(),
@@ -78,6 +78,22 @@
}
});
$(document).ready(function () {
const $form = $("#userForm");
$form.validate({
errorClass: "text-danger small",
errorPlacement: function (error, element) {
error.appendTo(element.parent());
}
});
// $form.on("submit", function (e) {
// if (!$form.valid()) {
// e.preventDefault(); // Ne küldje be, ha van hiba
// }
// });
});
</script>
}