v0.9.15g - NameCheck
This commit is contained in:
@@ -16,14 +16,15 @@
|
||||
}
|
||||
</style>
|
||||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
|
||||
<h1>Opret Nyhed</h1>
|
||||
<h1 id="errormesseages" >Opret Nyhed</h1>
|
||||
<form method="post" action="{{ route("news.store") }}">
|
||||
@csrf
|
||||
<label for="title">Titel på nyheden:</label>
|
||||
<label hidden id="error" for="errormesseages">Dette navn findes allerede</label>
|
||||
<input type="text" name="subname" id="title" placeholder="OBS: Menuplanen er ændret" required>
|
||||
<div id="editor"></div>
|
||||
<textarea name="content" class="d-none" id="hiddenArea"></textarea>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Opret">
|
||||
<input type="submit" id="disable" class="btn btn-dark text-white" value="Opret">
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
@@ -65,5 +66,60 @@
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
//Dont delete me, if the user reloads the pages with text in the text-box this code runs.
|
||||
$(document).ready(function () {
|
||||
$value = $('#title').val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('news.nameCheck')}}',
|
||||
data: {'nameCheck':$value},
|
||||
success:function (data) {
|
||||
console.log(data);
|
||||
if(data){
|
||||
$("#error").show(100);
|
||||
$("#error").css('color', 'red');
|
||||
$("#disable").prop('disabled', true);
|
||||
$('#disable').css('cursor','not-allowed');
|
||||
}else{
|
||||
$("#error").hide();
|
||||
$("#disable").prop('disabled', false);
|
||||
$('#disable').css('cursor','pointer');
|
||||
}
|
||||
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#title').on('keyup', function () {
|
||||
$value = $(this).val();
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('news.nameCheck')}}',
|
||||
data: {'nameCheck':$value},
|
||||
success:function (data) {
|
||||
if(data){
|
||||
$("#error").show(100);
|
||||
$("#error").css('color', 'red');
|
||||
$("#disable").prop('disabled', true);
|
||||
$('#disable').css('cursor','not-allowed');
|
||||
}else{
|
||||
$("#error").hide();
|
||||
$("#disable").prop('disabled', false);
|
||||
$('#disable').css('cursor','pointer');
|
||||
}
|
||||
|
||||
},
|
||||
error:function (data) {
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user