How to make validation to confirm password ()
See original GitHub issueHow to make validation to mutch checking 2 fields ?
Method below work, but register: required and minLength works only onBlur…
<input type="text" name="newPassword" ref={register({ required: true, minLength: 8})}
onChange={e => {
const value = e.target.value
if (value !== password) return clearError("confirmPassword")
setError("confirmPassword", "notMatch", "passwords not mutch")
}}
required autoFocus/>
Without mutch checking register: required and minLength work good.
<input type="text" name="newPassword" ref={register({ required: true, minLength: 8})} placeholder="Новый пароль" required/>
In ( required: validate: (value) => value === password ) program not watch const password …
<input type="text" name="newPassword" ref={register({ validate: (value) => value === password })} placeholder="Новый пароль" required/>
Who maked same validation to mutch checking fields ?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:35 (17 by maintainers)
Top Results From Across the Web
Confirm password validation in JavaScript - javatpoint
Confirm password validation in JavaScript · A password should be alphanumeric. · First letter of the password should be capital. · Password must...
Read more >How to validate confirm password using JavaScript
First of all, we will type the password in both password input and confirm password input then we will compare both the input...
Read more >Laravel Password & Password_Confirmation Validation
I have a paasword and a confirm password field i have validated it using laravel but even the password is same for both...
Read more >How To Create a Password Validation Form - W3Schools
Learn how to create a password validation form with CSS and JavaScript. Password Validation. Try it Yourself ». Create A Password Validation Form....
Read more >Password and Confirm Password validation using JavaScript ...
Inside the Validate JavaScript function, the values of the Password and the Confirm Password TextBoxes are fetched and are compared. If the values...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
it’s closure, you need to move watch inside the function.
In case someone else bumps into this. Using example above the error never showed up for me, I needed to add the error message output to the validate function.