Interface HasValidationProperties
- All Superinterfaces:
com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasValidation,Serializable
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbindErrorMessage(com.vaadin.flow.signals.Signal<String> signal) default voidbindInvalid(com.vaadin.flow.signals.Signal<Boolean> signal) Binds a given boolean signal to the invalid state of the component.default StringGets the error message displayed for all constraint violations if it has been set withsetErrorMessage(String).default booleanGets whether the component is currently in invalid state.default voidsetErrorMessage(String errorMessage) Sets a single error message to display for all constraint violations.default voidsetInvalid(boolean invalid) Sets the invalid state of the component.Methods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidation
-
Method Details
-
setErrorMessage
Sets a single error message to display for all constraint violations. The error message will only appear when the component is flagged as invalid, either as a result of constraint validation or by the developer throughsetInvalid(boolean)if manual validation mode is enabled.- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Parameters:
errorMessage- the error message to set, ornullto clear
-
getErrorMessage
Gets the error message displayed for all constraint violations if it has been set withsetErrorMessage(String). Otherwise, gets the current i18n error message if the value is currently invalid.- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Returns:
- the error message
-
bindErrorMessage
Binds a given signal to the single error message to display for all constraint violations. The error message will only appear when the component is flagged as invalid, either as a result of constraint validation or by the developer through
setInvalid(boolean)if manual validation mode is enabled.Signal's value
nullclears the error message.- Specified by:
bindErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Parameters:
signal- the signal to bind the error message to, notnull- Since:
- 25.1
-
setInvalid
default void setInvalid(boolean invalid) Sets the invalid state of the component.NOTE: If you need to manually control the invalid state, enable manual validation mode with
HasValidation.setManualValidation(boolean)to avoid potential conflicts between your custom validation and the component's constraint validation.- Specified by:
setInvalidin interfacecom.vaadin.flow.component.HasValidation- Parameters:
invalid-truefor invalid,falsefor valid
-
isInvalid
default boolean isInvalid()Gets whether the component is currently in invalid state.- Specified by:
isInvalidin interfacecom.vaadin.flow.component.HasValidation- Returns:
truefor invalid,falsefor valid
-
bindInvalid
Binds a given boolean signal to the invalid state of the component.The invalid state controls whether the component is considered invalid and whether a possible error message is shown. If manual validation mode is enabled with
HasValidation.setManualValidation(boolean), then the value provided by the bound signal determines the visual invalid state of the component.Signal's value
nullis treated asfalse.- Specified by:
bindInvalidin interfacecom.vaadin.flow.component.HasValidation- Parameters:
signal- the signal to bind the invalid state to, notnull- Since:
- 25.1
-