Replies: 4 comments 2 replies
-
|
Beta Was this translation helpful? Give feedback.
-
You must use <button
onClick={() => {
console.log(getValues('test'));
}}
/> |
Beta Was this translation helpful? Give feedback.
-
Yeah, watch not working. My scenario is - i create field with a default value in disabled state(tu undisable later). While input is disabled, watch or getValues treat input as empty. The only way i make it work is to disable field with chakra's props, rather than with use-hook-form <Input
disabled={true} // working
{...register(`${institutionName}.name`, {
// disabled: true, // Not working. Treated as empty by `getValues` or `watch`.
})}
/> |
Beta Was this translation helpful? Give feedback.
-
RHF follows the native HTML API behaviour and sets disabled fields to
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
getValues('test')
returns nothingIs there a way to get value from disabled field?
Beta Was this translation helpful? Give feedback.
All reactions