FIX_FE_content api

This commit is contained in:
sanjeev.p 2026-01-27 12:14:06 +05:30
parent b100c462af
commit 85c4794e84

View File

@ -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('');
}
});
</script>
<script>