Fix: revalidate Method Focuses Field Instead of Showing Errors #169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Initialize
JustValidate
with validation rules:Call validation.revalidate().
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.