-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Prerequisites
- I have read the documentation;
- In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.
Description
Following on from my last suggestion:
I'd like to suggest enabling the "required" field on arrays and radio buttons.
If we make the changes I suggested in the above issue, we can enabled the "required" field on arrays. The use case would be where we want the user to select "at least one" checkbox in a list.
Also, the RadioWidget input supports the "required" tag, which in addition to being a nicer prompt for the user is also consistent with it's usage elsewhere in the module.
Steps to Reproduce
- [First Step]
Attempt to make a radio button list mandatory, or an array mandatory. - [Second Step]
For the radio widget instead of a clean "please fill in the field" message that we get when we use the mandatory tag, we get the errorlist returned.
If issue 410 is also addressed then we can make an array mandatory. Without 410 an empty array is still an array and so it won't work. With it we can make an array mandatory. We can't use the "required" HTML attribute, but at least the validation routines will return and prompt us with the error of the missing selection.
Expected behavior
For radio buttons: They should act like any other input that supports the "required" attribute.
For arrays (with 410): We should be able to make it possible to force the user to select "at least one" element in an array.
Actual behavior
Radio buttons go straight to the validation routine. While it works it's not as neat or consistent IMO.
You can't have mandatory arrays currently at all.
Version
Latest
Again here is the change in my fork:
Commit: a020837 [a020837]