v0.9.15h - NameCheck - Fixed Updates
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
@csrf
|
||||
@method("PUT")
|
||||
<label for="title">Navn</label>
|
||||
<label hidden id="error" for="errormesseages">Navn findes allerede</label>
|
||||
<input value="{{$guide->name}}" type="text" name="name" id="title" required>
|
||||
<label for="editor">Vejledning</label>
|
||||
<div id="editor">{!! $guide->guide_articles !!}</div>
|
||||
@@ -38,7 +39,7 @@
|
||||
<span class="toggle__text">Opret som nyhed</span>
|
||||
</span>
|
||||
</label>
|
||||
<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>
|
||||
@@ -79,5 +80,57 @@
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$value = $('#title').val();
|
||||
console.log($value);
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '{{route('guides.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$guide->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('guides.nameCheckUpdate')}}',
|
||||
data: {'nameCheck':$value, 'id':{{$guide->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