Enum Class ValidationTrigger
- All Implemented Interfaces:
Serializable,Comparable<ValidationTrigger>,Constable
ValidationTrigger controls the automatic validation behavior of validated inputs. Different triggers provide different user experiences - some validate immediately, others wait for user interaction.
Recommended Approach: Use BLUR_THEN_CHANGE for most fields.
This provides the best user experience by not showing errors while typing, but providing
immediate feedback after the user has completed initial input.
Usage:
ValidatedInput<String> email = new ValidatedInput<>(emailInput, emailError)
.required()
.email()
.validateOn(ValidationTrigger.BLUR_THEN_CHANGE);
- Since:
- 2025
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionValidate when the field loses focus.Validate on blur first, then on every change after that.Validate on every value change.Never auto-validate; only validate when explicitly called.Validate only on form submission. -
Method Summary
Modifier and TypeMethodDescriptionstatic ValidationTriggerReturns the enum constant of this class with the specified name.static ValidationTrigger[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BLUR
Validate when the field loses focus.This is a good default for most fields. Validation runs when the user tabs or clicks away from the field, providing feedback without interrupting typing.
-
CHANGE
Validate on every value change.Provides immediate feedback as the user types. Use sparingly as it can be distracting and generates many validation requests. Best suited for fields where immediate feedback is valuable, such as password strength indicators.
-
SUBMIT
Validate only on form submission.Defers all validation until the user attempts to submit the form. Good for performance-sensitive forms or when you prefer a traditional form experience.
-
BLUR_THEN_CHANGE
Validate on blur first, then on every change after that.This provides the best user experience for most cases:
- User enters a value and moves to the next field
- First validation runs on blur
- If invalid, subsequent changes trigger immediate validation
- If valid, changes don't trigger validation until blur again
This avoids showing errors while the user is still typing their initial input, but provides immediate feedback once they're trying to correct an error.
-
MANUAL
Never auto-validate; only validate when explicitly called.Use this when you want full control over when validation occurs, such as wizard-style forms where validation happens on step navigation.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-