Originally posted by **CleitonDeLima** May 29, 2024
If include a field checkbox in `dependent_fields`, the `'on'` value is sent to the view regardless of whether the field is checked or not.
This behavior can be changed [here](https://github.com/codingjoe/django-select2/blob/main/django_select2/static/django_select2/django_select2.js#L30)
```js
$.each(dependentFields, function (i, dependentField) {
var field = $("[name=" + dependentField + "]", $element.closest("form"));
if (field.is(":checkbox")) {
result[dependentField] = field.prop("checked");
} else {
result[dependentField] = field.val();
}
});
```
Discussed in https://github.com/codingjoe/django-select2/discussions/282