We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
2.7.2
When using a RadioGroup with Radio components, toggling to other radio options sets the value on the RHF form to null
RadioGroup
Radio
null
Code Sandbox
type Input = { type: string, }; export default function IndexPage() { const { register, watch } = useForm<Input>(); const values = watch(); console.log(values); return ( <DefaultLayout> <Form> <RadioGroup label="Type" {...register("type")}> <Radio value="customer">Customer</Radio> <Radio value="employee">Employee</Radio> </RadioGroup> </Form> </DefaultLayout> ); }
Toggling to customer, will console.log { type: "customer" } but toggling to employee will console.log { type: null }
{ type: "customer" }
{ type: null }
The value should be set instead of null
No response
Windows
Chrome
The text was updated successfully, but these errors were encountered:
ENG-2148 [BUG] - RadioGroup doesn't work with RHF
Sorry, something went wrong.
Wrapping it in a Controller fixes it as a workaround
Controller
<Controller control={control} name={"type"} render={({ field: { onChange, onBlur, value } }) => ( <RadioGroup label="Type" value={value} onBlur={onBlur} onChange={onChange} > <Radio value="customer">Customer</Radio> <Radio value="employee">Employee</Radio> </RadioGroup> )} />
which RHF version are you using? To speed up the process, you may share a sandbox instead so that we could look into it faster.
The latest one 7.54.2. I edited my initial post to include the sandbox
No branches or pull requests
HeroUI Version
2.7.2
Describe the bug
When using a
RadioGroup
withRadio
components, toggling to other radio options sets the value on the RHF form tonull
Your Example Website or App
Code Sandbox
Steps to Reproduce the Bug or Issue
Toggling to customer, will console.log
{ type: "customer" }
but toggling to employee will console.log{ type: null }
Expected behavior
The value should be set instead of null
Screenshots or Videos
No response
Operating System Version
Windows
Browser
Chrome
The text was updated successfully, but these errors were encountered: