backbone-forms icon indicating copy to clipboard operation
backbone-forms copied to clipboard

required array values must contain 1 element

Open exussum12 opened this issue 12 years ago • 7 comments

fix for #266

exussum12 avatar Oct 15 '13 14:10 exussum12

what's the actual use-case where this was an issue?

philfreo avatar Oct 15 '13 14:10 philfreo

Checking when arrays of values are returned, All current checks assume string values and checks for blank or false strings. An empty array returned by Checkboxes for example should be treated the same as an empty string passed from a Text input.

Specifying required on a Checkboxes item currently will never return an error what ever value it is passed

exussum12 avatar Oct 15 '13 14:10 exussum12

For example Which days are best for you ? Checkboxes of Monday - Sunday, a value of [] should not be accepted, ['Tuesday'] should and ['Tuesday','Wednesday'] etc should. But a empty array should not (ie no days selected)

exussum12 avatar Oct 15 '13 15:10 exussum12

Cool. It would be really nice if there was a test of this higher-level checkbox use case showing that this patch is necessary.

philfreo avatar Oct 15 '13 15:10 philfreo

Where would that test go in the Validators ? or the Checkboxes ?

exussum12 avatar Dec 21 '13 00:12 exussum12

Any chance of this getting pulled in? Without this patch the "required" validation on a single check box does not work.

richardaday avatar Mar 04 '14 06:03 richardaday

Sorry deleted the branch

exussum12 avatar Sep 16 '14 13:09 exussum12