Opened 19 years ago
Closed 18 years ago
#624 closed defect (fixed)
formfields.CheckboxSelectMultipleField validators are broken
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Core (Other) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Trying to find a good way to validate that >=1 of 2 checkboxes in a group are selected, I have noticed that:
*CheckboxSelectMultipleField validators are broken because the renderer munges the field names such that validators do not receive any field data. This allows submission of arbitrary choice data because the default validator isValidChoice always passes.
*CheckboxField does not take the validator_list keyword argument - this prevents the first non-ideal solution that occured to me which would be to add RequiredIfOtherFieldNotGiven to the validator_list for one checkbox
Let me know if there is a built-in solution that I've missed.
Kieran
Fixed in newforms.