React-final-form: input[type=checkbox] should behave as select[multiple]

Created on 30 Dec 2017  路  11Comments  路  Source: final-form/react-final-form

Are you submitting a bug report or a feature request?

I don't know, problably a bug... or a feature :)

What is the current behavior?

When using using input type="checkbox" we only can get a boolean.

https://codesandbox.io/s/n4ppqq63n0

What is the expected behavior?

In this example, I really want it to behave as the select with multiple option.

Sandbox Link

What's your environment?

Other information

Appart from this, lib is perfect :+1: keep the good work

Most helpful comment

Heh. I wrote a long informative comment here, but then my computer crashed.

In short, I considered your request and found it fairly easy to implement.

All 11 comments

I'm in the same boat as @brikou doesn't look like there's much testing on checkbox fields, yet.

https://github.com/final-form/react-final-form/blob/95a4c58c9fabbbbca4b892f3c8eb06eab8f214a2/src/Field.test.js#L462

Heh. I wrote a long informative comment here, but then my computer crashed.

In short, I considered your request and found it fairly easy to implement.

@erikras any idea when this will be released (pushed to npm repo) ? Thanks.

Probably today. I want to knock out a couple of other things and then publish.

@erikras you rock!

Fix published in v2.2.0.

@erikras thank you

This functionality has been added to the Simple Example. It's pretty easy!

Hi, how validate it?
As example all checkboxes should be checked

@borm Huh? Can you explain further what your requirements are?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings