Package com.vaadin.flow.component.shared
Interface HasValidationProperties
- All Superinterfaces:
com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasValidation,Serializable
public interface HasValidationProperties
extends com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasValidation
Mixin interface for components that provide properties for setting invalid
state and error message string to show when invalid.
- Author:
- Vaadin Ltd
-
Method Summary
Modifier and TypeMethodDescriptiondefault StringGets the error message to show to the when the component is invalid.default booleanGets whether the component is currently in invalid state.default voidsetErrorMessage(String errorMessage) Sets the error message to show to the user when the component is invalid.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 the error message to show to the user when the component is invalid.- Specified by:
setErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Parameters:
errorMessage- the error message ornullto clear it
-
getErrorMessage
Gets the error message to show to the when the component is invalid.- Specified by:
getErrorMessagein interfacecom.vaadin.flow.component.HasValidation- Returns:
- the error message or
nullif not set
-
setInvalid
default void setInvalid(boolean invalid) Sets the invalid state of the component.NOTE: If you need to manually control the invalid state, consider enabling manual validation mode with
HasValidation.setManualValidation(boolean)to avoid potential conflicts between your custom validation and the component's built-in 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
-