Skip to content

Conversation

@jaycollett
Copy link

Summary

Fixes a bug where checkbox-type config options (like ignore_tls) always save as "1" regardless of whether the checkbox is checked or unchecked.

Problem

The JavaScript code collecting config values uses $(this).val() for all form elements. For checkboxes, .val() returns the value attribute (typically "1") rather than reflecting the checked state. This means unchecking a boolean config option has no effect - it still saves as "1".

Solution

Check if the element is a checkbox and use the :checked state to determine the value:

if ($(this).is(":checkbox")) {
  data[config] = $(this).is(":checked") ? "1" : "0";
} else {
  data[config] = $(this).val();
}

Test plan

  • Add an enhanced app with a boolean config option (e.g., Pi-hole with ignore_tls)
  • Enable the checkbox, test config - verify it saves as "1"
  • Disable the checkbox, test config - verify it now saves as "0"

Fixes linuxserver/Heimdall-Apps#782

The .val() method on checkbox elements returns the value attribute
(typically "1") regardless of the checked state. This caused boolean
config options like ignore_tls to always be saved as "1" even when
the checkbox was unchecked.

Fixed by checking if the element is a checkbox and using the :checked
state to determine the value.

Fixes linuxserver/Heimdall-Apps#782
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

Skip TLS always returns 1

1 participant