main
Ilham Wara Nugroho 2026-01-15 13:56:01 +07:00
parent 63a6207271
commit c5e0572ab4
2 changed files with 14 additions and 9 deletions

View File

@ -913,7 +913,7 @@ if (!function_exists('formKriteria')) {
</div>
</div>
<div id="uploaded-files" style="margin-top: 20px;">
<ul id="file-list">';
<ul id="file-list" data-file="'.(@$valueLink ? count(@$valueLink) > 0 ? 'true' : 'false' : 'false').'">';
if(@$valueLink){
if(is_array(@$valueLink)){
foreach(@$valueLink as $kuy => $file){

View File

@ -279,6 +279,7 @@
let allData = {};
let isValid = true; // Flag validasi
let isMultiple = true; // Flag validasi
let file = $('#file-list').attr('data-file');
currentForm.forEach(field => {
let name = field.name.replace(/\[\]$/, ''); // Hapus "[]" di akhir nama input
@ -293,12 +294,15 @@
}
});
// alert(file);
$('.is-required').each(function () {
let type = $(this).attr('type');
let name = $(this).attr('name');
let value = $(this).val()?.trim(); // Pastikan nilai di-trim untuk menghindari spasi kosong
let uploadedFilesValue = $('.uploadedFiles').val();
if(file == 'false'){
if (!uploadedFilesValue || uploadedFilesValue === '') {
isValid = false;
$('.uploadedFiles').addClass("is-invalid");
@ -307,6 +311,7 @@
} else {
$('.uploadedFiles').removeClass("is-invalid");
}
}
if (type === 'radio') {
// Validasi radio: setidaknya satu opsi harus dipilih