Skip to content

Commit

Permalink
Handling checkboxes better #779
Browse files Browse the repository at this point in the history
  • Loading branch information
jokob-sk committed Sep 28, 2024
1 parent 02077d4 commit 9144fd0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions front/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,16 @@ function saveSettings() {

settingsArray.push([prefix, setCodeName, dataType, value]);

} else if (dataType === 'boolean') {
} else if (inputType === 'checkbox') {

value = $(`#${setCodeName}`).is(':checked') ? 1 : 0;
value = applyTransformers(value, transformers);
value = $(`#${setCodeName}`).is(':checked') ? 1 : 0;

if(dataType === "boolean")
{
value = value == 1 ? "True" : "False";
}

value = applyTransformers(value, transformers);
settingsArray.push([prefix, setCodeName, dataType, value]);

} else if (dataType === "array" ) {
Expand Down Expand Up @@ -757,6 +762,7 @@ function saveSettings() {

value = $('#' + setCodeName).val();
value = applyTransformers(value, transformers);
console.error(`[saveSettings] Saving value "${value}"`);
settingsArray.push([prefix, setCodeName, dataType, value]);
}
});
Expand Down

0 comments on commit 9144fd0

Please sign in to comment.