highercomve/react-valida-hook

input type checkbox

shido76 opened this issue · 4 comments

Is react-valida-hook working with input type checkbox? I try:

<Checkbox name="favorite" { ...formData.favorite.input } /> Favorite

but don't work. Value of favorite is not update in state.

That component has the onInput event?

This component is only a wrapper around a checkbox input tag.
I think that onInput event is listen only in text and textarea inputs.

Ok, yeah, in fact, we are using here the onChange event.

But yeah in there we have a bug because the currentTarget.value is not correct for checkbox

I guess there are some special cases for the onChange event in there. If is type checkbox use negate the state and use checked instead of value.

I guess i will need to change somethings in there.

Yes. I think so. Thank you for your reply