react-hook-form: [Bug] Hidden input is ignored, when another input with `register()` is present
Hidden input is ignored, when another input with register() is present 🐞
To Reproduce
- Go to https://codesandbox.io/s/distracted-payne-1ooyh?file=/src/App.js
- Click on Submit
- Expected: In console check a submit object: test[0].validation has to be present with value
false. Current: validation field is missing. - Select any value in
<select>dropdown - Expected: In console check a watch object: test[0].validation has to be present with value
true. Current: validation field is missing.
Codesandbox link https://codesandbox.io/s/distracted-payne-1ooyh?file=/src/App.js
- Version: checked 6.5.3 and 6.6.0
Additional context Removing from code
<input
defaultValue={fields[index].required}
ref={register()}
name={`test[${index}].required`}
type="text"
/>
helps to solve onChange issue. But a default value is still ignored and empty.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 32 (17 by maintainers)
Brilliant. Waiting for the next release! Thank you a lot!
please confirm if the above works. 👍
hmmm, looks like test again looks like it’s otherwise… I will take a look at it again later.
Nah, that’s fine. as long as we can resolve the problem here. The video certainly helped, but it should remove item even with setValue which is registered.
for min length, i think it’s easier to do the following: