question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

input.checked not passed even if value is a boolean?

See original GitHub issue

According 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:open
  • Created 7 years ago
  • Reactions:8
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
danielrobcommented, Aug 7, 2017

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 add type="checkbox" and a thumbs down for the docs stating you need to add type="checkbox"

Related: #2292

0reactions
aijcommented, Nov 13, 2017

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found