You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That this update changes
With this update, JS validation does not need to be enabled in order for field errors to disappear on change events.
Where this update might break
I'd mostly look out for JS errors in the console. Validating all fields always might introduce an error somewhere in our validation logic. I don't think it's likely though as I'm not aware of any issues with our JS validation setting throwing errors. If there are, these are good to catch anyway.
It also wouldn't hurt to test with JS validation on as well.
To replicate
Ensure the form does not have JS validation enabled.
Submit the form in a case where errors would appear (like required field validation).
Update the field.
Previously, the error would remain. Now, it disappears.
Before
Screen.Recording.2026-06-05.at.11.39.51.AM.mov
After
Screen.Recording.2026-06-05.at.11.39.20.AM.mov
Summary by CodeRabbit
Bug Fixes
Improved URL field error handling to ensure stale validation errors are properly cleared even when JavaScript validation is disabled, while preventing new validation errors from appearing unless validation is active.
The form validation flow is updated to support conditional error UI. maybeValidateChange now calls validateField unconditionally for URL fields with a flag indicating whether JS validation is enabled, and validateField accepts an addErrors parameter to control whether validation errors get re-added to the UI or only cleared.
Changes
Conditional Form Field Validation
Layer / File(s)
Summary
Conditional error UI in validation flow js/formidable.js
maybeValidateChange now unconditionally calls validateField with a boolean flag indicating JS validation mode, and validateField branches error-UI logic: when the flag is true, existing errors are cleared and repopulated; when false, errors are only removed if the field has no current validation errors.
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
A form that clears its errors right,
Whether validation runs in JS light,
Or stands alone with flags so clear—
Stale mistakes just disappear! 🐰✨
The title is incomplete (ends with 'regardless of…') but clearly references the main change: removing validation errors regardless of a setting, which aligns with the actual changes to error handling in validateField.
Docstring Coverage
✅ Passed
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
✅ Passed
Check skipped because no linked issues were found for this pull request.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches📝 Generate docstrings
Create stacked PR
Commit on current branch
🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch update_js_validation_to_always_remove_errors_when_valid
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
We reviewed changes in b7cd07c...b32a1b2 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
The reason will be displayed to describe this comment to others. Learn more.
Wrap the body of a for-in loop in an if statement with a hasOwnProperty guard
Looping over objects with a for in loop will include properties that are inherited through the prototype chain. This behavior can lead to unexpected keys in your for loop.
Pass through addErrors when validating the confirmation field
confirmField() calls validateField( confirmField ) without the addErrors argument at line 636, so validateField() falls back to addErrors = true.
This breaks the intended behavior when validateField() is called with addErrors = false (e.g., via maybeValidateChange() using hasClass(form, 'frm_js_validate')): the main field won’t add new errors, but the confirmation field can.
Fix: pass the same addErrors value into validateField( confirmField, addErrors ) (thread it through, or compute it from confirmField.closest('form')).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@js/formidable.js` at line 636, The confirmation-field validation is calling
validateField(confirmField) without forwarding the addErrors flag, so
confirmField() should call validateField(confirmField, addErrors) (or compute
addErrors from confirmField.closest('form') the same way maybeValidateChange()
does) to preserve the caller's addErrors=false behavior; update confirmField()
to accept/derive the addErrors boolean and pass it through to validateField so
the confirmation field won't add errors when the main validation is invoked with
addErrors=false.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@js/formidable.js`:
- Line 636: The confirmation-field validation is calling
validateField(confirmField) without forwarding the addErrors flag, so
confirmField() should call validateField(confirmField, addErrors) (or compute
addErrors from confirmField.closest('form') the same way maybeValidateChange()
does) to preserve the caller's addErrors=false behavior; update confirmField()
to accept/derive the addErrors boolean and pass it through to validateField so
the confirmation field won't add errors when the main validation is invoked with
addErrors=false.
ℹ️ Review info⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3eced1b6-1ee5-47a7-b778-fefbc9a991c7
📥 Commits
Reviewing files that changed from the base of the PR and between b7cd07c and b32a1b2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
… validation setting
That this update changes
With this update, JS validation does not need to be enabled in order for field errors to disappear on change events.
Where this update might break
I'd mostly look out for JS errors in the console. Validating all fields always might introduce an error somewhere in our validation logic. I don't think it's likely though as I'm not aware of any issues with our JS validation setting throwing errors. If there are, these are good to catch anyway.
It also wouldn't hurt to test with JS validation on as well.
To replicate
Previously, the error would remain. Now, it disappears.
Before
Screen.Recording.2026-06-05.at.11.39.51.AM.mov
After
Screen.Recording.2026-06-05.at.11.39.20.AM.mov
Summary by CodeRabbit
Bug Fixes