[rules] maxLength message in rule does not pick most recent value #10859
Unanswered
sunny-mody
asked this question in
Q&A
Replies: 0 comments
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to have a
maxLength
validation on field.If the character length goes beyond the limit (consider 5 for this example), we need to show count of characters entered by user.
Sample error message
max char allowed 10/5
here 10 is count of characters entered in textbox & 5 is the max limit
https://codesandbox.io/s/react-hook-form-validation-maxlength-forked-82d3qm?file=/src/App.jsx
Open above codesanbox & type more than 5 characters in last name textbox.
Notice that every time you type a character, count of character is the previous state of text box.
Any pointers?
Beta Was this translation helpful? Give feedback.
All reactions