diff --git a/app/Views/frontend_content_list.php b/app/Views/frontend_content_list.php index c88484f3..e2e62833 100644 --- a/app/Views/frontend_content_list.php +++ b/app/Views/frontend_content_list.php @@ -460,7 +460,7 @@ } }else{ toastr.error("Something went wrong!", 'Error'); - } + }} }); } @@ -478,8 +478,13 @@ function appendEditData(data) { $('#frontEndContentForm')[0].reset(); $('#fe_id').val(data.id); - $('#type').val(data.type); - $('#content_section').val(data.content_section); + if (/video/i.test(data.content_section)) { + $('#content_section').val('Video'); + $('#type').val(8); + } else { + $('#type').val(data.type); + $('#content_section').val(data.content_section); + } $('#heading').val(data.heading); // $('#content').val(data.content); // $('#notes').val(data.notes); @@ -533,6 +538,34 @@ return text.length === 0; } + // $('#content_section').on('keyup blur change', function () { + // let val = $(this).val(); + // if (/video/i.test(val)) { + // $(this).val('Video'); + // $('#type').val(8); + // } + // }); + + + $('#content_section').on('input blur', function () { + let $this = $(this); + let val = $this.val().trim(); + + // 1. Handle Empty Input + if (val === '') { + $('#type').val(''); + return; + } + + // 2. Check for "video" (case insensitive) + if (/video/i.test(val)) { + $('#type').val(8); + if (val !== 'Video') { $this.val('Video'); } + } else { + $('#type').val(''); + } + }); +