Na most egy validator is beköszönt
This commit is contained in:
@@ -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>
|
||||
}
|
||||
Reference in New Issue
Block a user