Open stephenmathieson opened 10 years ago
Fwiw, the HTML5 spec calls for unchecked elements to be skipped altogether when constructing the dataset. I think it would be good to mimic this behavior, as it's already defined and probably expected by most users/developers.
is there any case where someone would want unchecked elements to be skipped ?
+1 to setting false
when they are unchecked just cuz doying || false
is a PITA.
afaik, the recommended way to approach this is to have 2 inputs:
<input type="hidden" name="check" value="false">
<input type="checkbox" name="check" value="true">
If the checkbox is checked, true
will clobber the false
. When unchecked, false
shows through instead.
(that's how my form serialize library will handle this in my upcoming version anyways)
here's my use case:
if the second checkbox isn't submitted, then how do i know a user doesn't want to display things that don't matter to anyone?
i've already deployed with || false
, so i'm not terribly worried about it, but it'd be nice to clean up some of that garbage in a future iteration.
@yields any thoughts on default behaviour here?
sounds right to me :)
i'm doing this to compensate and it just seems wrong: