v0.9.15h - NameCheck - Fixed Updates
This commit is contained in:
@@ -21,10 +21,11 @@
|
||||
@csrf
|
||||
@method("PUT")
|
||||
<label for="title">Navn</label>
|
||||
<input value="{{$news->name}}" type="text" name="subname" id="title" required>
|
||||
<label hidden id="error" for="errormesseages">Dette navn findes allerede</label>
|
||||
<input value="{{$news->subname}}" type="text" name="subname" id="title" required>
|
||||
<div id="editor">{!! $news->content !!}</div>
|
||||
<textarea name="content" class="d-none" id="hiddenArea"></textarea>
|
||||
<input type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||
<input id="disable" type="submit" class="btn btn-dark text-white" value="Rediger">
|
||||
</form>
|
||||
|
||||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
|
||||
@@ -65,5 +66,57 @@
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
//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.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id': {{$news->id}}},
|
||||
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.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id': {{$news->id}}},
|
||||
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