input.checked not passed even if value is a boolean?
See original GitHub issueAccording to the Field docs, checked should be passed as a prop the wrapped component if the value is a boolean:
input.checked : boolean [optional]
An alias for value only when value is a boolean. Provided for convenience of destructuring the > whole field object into the props of a form element.
But, even if the value is a boolean, to me it seems that input.checked is provided only if I specify the prop type="checkbox"
on the Field component?
I could be doing something wrong of course. But is it possible that this is a bug or is there something missing the documentation? The documented props you can pass to Field says nothing about type
.
I would be glad to contribute if someone points me in the right direction.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:8
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Angular 5, HTML, boolean on checkbox is checked
I can't seem to get the checkbox to be checked when returning a boolean, I've tried, item.check returns either true or false. <tr...
Read more >Boolean inputs are not actually booleans · Issue #1483 - GitHub
I have run into this issue as well, it is tricky to identify and debug. I have just been ensuring I always cast...
Read more >.prop() | jQuery API Documentation
According to the W3C forms specification, the checked attribute is a boolean attribute, which means the corresponding property is true if the attribute...
Read more >HTML input checked Attribute - W3Schools
The checked attribute is a boolean attribute. When present, it specifies that an <input> element should be pre-selected (checked) when the page loads....
Read more >HTML | DOM Input Checkbox defaultChecked Property
Return Values: It returns a Boolean value that returns true if the checkbox is checked by default otherwise returns false.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Question here: it seems clear that if
type="checkbox"
is specified, this works. Are people wishing for the docs to be correct, or wishing for the docs to reflect the current behaviour? Add a thumbs up for not needing to addtype="checkbox"
and a thumbs down for the docs stating you need to addtype="checkbox"
Related: #2292
@danielrob How is one supposed to use
type="checkbox"
with<Fields />
? (plural)I don’t care whether the documentation is changed to match the code, or the code is changed to match the documentation. I can see arguments going either way, but having them disagree is worse than either option.