correctly saving the need_custom_text status with a direct edit on the page. see #621

This commit is contained in:
mic 2026-01-20 23:48:07 +01:00
parent 0041a8a6a4
commit a888370fd2

View file

@ -807,13 +807,18 @@ async function handleCheckboxChange(e) {
e.preventDefault(); e.preventDefault();
e.target.setAttribute('checked_val', e.target.checked ? '1' : '0'); e.target.setAttribute('checked_val', e.target.checked ? '1' : '0');
if (e.target.classList.contains('enabled')) { if (e.target.classList.contains('enabled') || e.target.classList.contains('need_custom_text')) {
let tr = e.target.closest('tr'); let tr = e.target.closest('tr');
if (tr) { if (tr) {
let idnum = tr.getAttribute('data-idnum'); let idnum = tr.getAttribute('data-idnum');
let item = promptsList.get('idnum', idnum); let item = promptsList.get('idnum', idnum);
if (item && item.length > 0) { if (item && item.length > 0) {
item[0]._values.enabled = e.target.checked ? 1 : 0; if (e.target.classList.contains('enabled')) {
item[0]._values.enabled = e.target.checked ? 1 : 0;
}
if (e.target.classList.contains('need_custom_text')) {
item[0]._values.need_custom_text = e.target.checked ? 1 : 0;
}
} }
} }
} }