Replies: 1 comment
-
You'd have to host your own state because RHF needs to have the value stored and accessible in it's store in order to perform validation. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
What I Want :
I want to use an input that can only enter numeric values.
If a value other than a number is entered, I would like to display only the error message without updating the input value.
That way, the value will always keep the number.
What I Tried :
Code Sandbox : https://codesandbox.io/p/sandbox/register-forked-vyjskp?file=%2Fsrc%2FApp.js
React Hook Form Version :
7.50.1
Setting the
valueAsNumber:true
andtype="number"
removes non-numerical values, but no error occurs.When a
pattern
orvalidate
function is applied, non-numerical values are not removed, but are shown as they are.Is there a way to use only errors while keeping the same value?
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions