Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dependent_fields with checkbox #289

Open
codingjoe opened this issue Jul 2, 2024 Discussed in #282 · 0 comments
Open

Use dependent_fields with checkbox #289

codingjoe opened this issue Jul 2, 2024 Discussed in #282 · 0 comments
Labels
enhancement New feature or request

Comments

@codingjoe
Copy link
Owner

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();
  }
});
@codingjoe codingjoe added the enhancement New feature or request label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant