v0.10.2 - Full functioning AJAX check submit code on User controller create & edit
- Plus all other pages where you create or update something of an unique value
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
@section("content")
|
||||
<h1 id="errormesseages" >Opret Bruger:</h1>
|
||||
<form method="post" action="{{ route("users.store") }}" onsubmit="return myFunction()">
|
||||
<form method="post" action="{{ route("users.store") }}" onsubmit="return checkInputs()">
|
||||
@csrf
|
||||
<label for="name_first">Fornavn:</label>
|
||||
<input type="text" name="name_first" id="name_first" placeholder="Fornavn" required>
|
||||
@@ -71,7 +71,7 @@
|
||||
);
|
||||
});
|
||||
|
||||
function myFunction() {
|
||||
function checkInputs() {
|
||||
var save = true;
|
||||
$mail = $('#email').val();
|
||||
$phone = $('#phone').val();
|
||||
@@ -81,18 +81,18 @@
|
||||
url: '{{route('users.nameCheck')}}',
|
||||
data: {'mailCheck':$mail, 'phoneCheck':$phone},
|
||||
success:function (data) {
|
||||
if (data == 1) {
|
||||
if (data == 'both') {
|
||||
$("#erroremail").show(100);
|
||||
$("#erroremail").css('color', 'red');
|
||||
$("#errorphone").show(100);
|
||||
$("#errorphone").css('color', 'red');
|
||||
save = false;
|
||||
} else if(data == 2){
|
||||
} else if(data == 'email'){
|
||||
$("#errorphone").hide();
|
||||
$("#erroremail").show(100);
|
||||
$("#erroremail").css('color', 'red');
|
||||
save = false;
|
||||
} else if (data == 3) {
|
||||
} else if (data == 'phone') {
|
||||
$("#erroremail").hide();
|
||||
$("#errorphone").show(100);
|
||||
$("#errorphone").css('color', 'red');
|
||||
|
||||
Reference in New Issue
Block a user