Skip to content
New issue

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

No indication or error message when input does not match requirements #24

Open
shravankshenoy opened this issue Mar 28, 2024 · 0 comments

Comments

@shravankshenoy
Copy link

Describe the bug
When user enter a password which does not match the requirements (at least 8 characters, one uppercase, one lowercase, one number and one special character), then no error message is shown. This may cause user to get confused as to why sign up is not happening even though he/she has entered all the details correctly

To Reproduce
Open https://www.circuitparts.in/auth/signup or localhost:3000/auth/signup if running locally. Enter the following details

First Name : John
Last Name : Doe
Email : [email protected]
Password : 1234abcd

On clicking on Create Account, nothing happens, neither is any error message shown.

Expected behavior
An error message is shown as shown in image below, if password (or any other input) does not meet requirements
image

Version
NA

Possible Solution
We could use the ErrorMessage component which Formik provides, as shown in the code snippet below

<div className="grid gap-2">
  <label htmlFor="password">Password</label>
  <div className="relative">
    <Field 
     data-testid="password-input" 
     as={Input} 
     id="password" name="password"
     type={isPasswordVisible ? "text" : "password"} 
     placeholder="enter your password" 
     autoComplete="off" 
     formNoValidate
     required />
    
    <ShowPasswordButton
      isPasswordVisible="{isPasswordVisible}"
      setIsPasswordVisible="{setIsShowPassword}"
    />
    
    <ErrorMessage name="password" />
  </div>
</div>

Moreover to display form error only on submit we could disable validateonChange and validateonBlur as shown below

<Formik
  validateOnChange={false}
  validateOnBlur={false}
  ...
/ >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant