Automatic Error Setup
Setup errors on the fly — no attributes.
Superform now intelligently detects and manages automatically error messages related to form inputs, enhancing accuracy and user experience without the need for extensive manual setup.
Overview & Setup
The Proximity Context
Superform's Proximity Context system automatically detects error messages based on class keywords like "error," "invalid," or "fail" within any of the two siblings below and one sibling above an input field.
It can also toggle sf-error-class on inputs and their parent elements without needing explicit sf-error attributes ( sf-error-class and sf-error are part of the Manual Error Setup — see here).
Key Points:
Automatic Detection: Manages error messages within two siblings below or one sibling above the input.
Class Toggling: Automatically toggles error classes on both input fields and their parent elements for enhanced feedback.

Examples
1. Sibling Error
HTML Example
2. Two Sibling Errors
HTML Example
3. Two and One Sibling Errors
HTML Example
CSS Transitions of an Automatic Error
Apply CSS transitions, such as opacity, to create smooth visual effects for a more dynamic and engaging user experience.

Need even more granular control?
For more granular control over errors, such as toggling an extra class on error, or implementing toast notifications, please refer to the Manual Error Setup subpage.
Last updated
Was this helpful?