Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkbox array use case throws PropTypes warning #64

Open
stueynet opened this issue Mar 8, 2016 · 3 comments
Open

Checkbox array use case throws PropTypes warning #64

stueynet opened this issue Mar 8, 2016 · 3 comments

Comments

@stueynet
Copy link

stueynet commented Mar 8, 2016

With multiple checkboxes as part of an array, Formsy throws an error because formsy-material-ui/checkbox automatically sets checked to be the value of the checkbox.

https://github.com/mbrookes/formsy-material-ui/blob/master/src/FormsyCheckbox.jsx#L30

Unfortunately if you are trying to save actual values in an array, this falls apart. Example:

<FormsyCheckbox name="tags[]" value="test" label="test"/>
<FormsyCheckbox name="tags[]" value="test2" label="test2"/>
<FormsyCheckbox name="tags[]" value="test3" label="test3"/>

Material UI enhanced switch component PropTypes require that checked be a boolean here:
https://github.com/callemall/material-ui/blob/master/src/enhanced-switch.jsx#L77

So in your component you need to allow for value to be a string and separate from the checked prop if both are defined.

@mbrookes
Copy link
Collaborator

@stueynet Understood. Care to submit a PR?

@rmoskal
Copy link

rmoskal commented May 27, 2017

Any progress on this?

@ryanblakeley
Copy link
Collaborator

CC: #221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants