Skip to content

Use dependent_fields with checkbox #289

Open
@codingjoe

Description

@codingjoe

Discussed in #282

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

$.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();
  }
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions