When the unchecked value of a MultiCheckbox or Radio element is 0 and useHiddenElement is turned on, the FormMultiCheckbox helper renderes an empty string for the hidden element instead of 0.
Current behavior
The FormMultiCheckbox helper uses a ternary operator to check if the uncheckedValue of the element is falsy and then uses its own uncheckedValue. This results in ignoring a '0' as default unchecked value of the element because the ternary interprets '0' as false.
How to reproduce
Create a Radio element and enable useHiddenElement with a uncheckedValue of '0'.
Expected behavior
The value of the hidden element should be 0.
I'm not sure if the bugfix (PR with failing test for now #242) introduces a new, unexpected behavior for some consumers of this package?
Bug Report
Summary
When the unchecked value of a
MultiCheckbox
orRadio
element is0
anduseHiddenElement
is turned on, theFormMultiCheckbox
helper renderes an empty string for the hidden element instead of0
.Current behavior
The
FormMultiCheckbox
helper uses a ternary operator to check if theuncheckedValue
of the element is falsy and then uses its ownuncheckedValue
. This results in ignoring a'0'
as default unchecked value of the element because the ternary interprets'0'
asfalse
.How to reproduce
Create a Radio element and enable
useHiddenElement
with auncheckedValue
of'0'
.Expected behavior
The value of the hidden element should be
0
.I'm not sure if the bugfix (PR with failing test for now #242) introduces a new, unexpected behavior for some consumers of this package?