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

revalidate Method Focuses Field Instead of Showing Errors #155

Open
mdalaminbey opened this issue Dec 15, 2024 · 1 comment
Open

revalidate Method Focuses Field Instead of Showing Errors #155

mdalaminbey opened this issue Dec 15, 2024 · 1 comment

Comments

@mdalaminbey
Copy link

When calling revalidate, the input gets focused, but validation errors are not displayed unless the form is submitted.


Steps to Reproduce:

  1. Initialize JustValidate with validation rules:
    const validation = new JustValidate('#form');
    
    validation.addField('#email', [
      { rule: 'required', errorMessage: 'Email is required' },
      { rule: 'email', errorMessage: 'Invalid email format' },
    ]);
    
    validation.revalidate();
  2. Call validation.revalidate().
  3. The field is focused, but no error message is displayed.

Expected Behavior:

revalidate should validate the field and display the error message immediately without focusing the field.

@LuisJorgeLozano
Copy link

Hi @mdalaminbey!

I have encountered the same issue. In version 4.1.0, the revalidate method still shows the error message. Do you find a workaround on version 4.3.0?

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

2 participants