Skip to content

Conversation

devShamim
Copy link

Problem

When calling revalidate(), the input field gets focused as expected, but validation error messages are not displayed unless the form is submitted. This creates confusion as the field appears active but without any visible feedback.


Seps 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 input field is focused, but no error message is shown, even if it's invalid.

Expected Behavior

Calling revalidate() should trigger validation and display error messages immediately, without requiring form submission or additional interaction.

Solution

Updated calls to renderGroupError and renderFieldError to pass the forceRevalidation parameter. This ensures that errors are rendered properly during revalidation, improving the consistency of validation feedback.

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

Successfully merging this pull request may close these issues.

1 participant