Merged in bugfix/blockEnterarosV2 (pull request #347)

add block enter after add new customer
This commit is contained in:
Ain Izazi Aziz
2025-12-03 05:16:32 +00:00
+17 -2
View File
@@ -87,7 +87,7 @@
<h5 class="modal-title" id="ModalLabel">Daftar Pelanggan</h5>
</div>
<div class="modal-body">
<form action="{{ route('customer.store') }}" onsubmit="verifycustomer()" method="POST">
<form name="form-store" action="{{ route('customer.store') }}" onsubmit="verifycustomer()" method="POST">
@csrf
<div class="row form-group">
<div class="col-md-6">
@@ -358,7 +358,7 @@
<h5 class="modal-title" id="ModalLabel">Daftar Pelanggan</h5>
</div>
<div class="modal-body">
<form action="{{ route('customer.store') }}" onsubmit="verifycustomerpassport()" method="POST">
<form name="form-store" action="{{ route('customer.store') }}" onsubmit="verifycustomerpassport()" method="POST">
@csrf
<div class="row form-group">
<div class="col-md-6">
@@ -1346,6 +1346,21 @@
$('#pekerjaan-lain').val('');
lainContainer.hide();
}
});
document.getElementsByName('form-store')[0].addEventListener('keypress', function(e) {
// Jika tekan Enter
if (e.key === 'Enter') {
// Jika bukan butang submit dan bukan textarea
const tag = e.target.tagName.toLowerCase();
const type = e.target.type ? e.target.type.toLowerCase() : '';
if (tag !== 'textarea' && type !== 'submit') {
e.preventDefault();
return false;
}
}
});
</script>
@push('additional_scripts')