Package com.vaadin.flow.component.shared
Interface HasValidationProperties
- All Superinterfaces:
HasElement
,HasValidation
,Serializable
- All Known Implementing Classes:
AbstractNumberField
,BigDecimalField
,CheckboxGroup
,ComboBox
,ComboBoxBase
,CustomField
,DatePicker
,DateTimePicker
,EmailField
,IntegerField
,MultiSelectComboBox
,NumberField
,PasswordField
,RadioButtonGroup
,Select
,TextArea
,TextField
,TextFieldBase
,TimePicker
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 String
Gets the error message to show to the when the component is invalid.default boolean
Gets whether the component is currently in invalid state.default void
setErrorMessage
(String errorMessage) Sets the error message to show to the user when the component is invalid.default void
setInvalid
(boolean invalid) Sets the invalid state of the component.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Method Details
-
setErrorMessage
Sets the error message to show to the user when the component is invalid.- Specified by:
setErrorMessage
in interfaceHasValidation
- Parameters:
errorMessage
- the error message ornull
to clear it
-
getErrorMessage
Gets the error message to show to the when the component is invalid.- Specified by:
getErrorMessage
in interfaceHasValidation
- Returns:
- the error message or
null
if not set
-
setInvalid
default void setInvalid(boolean invalid) Sets the invalid state of the component.- Specified by:
setInvalid
in interfaceHasValidation
- Parameters:
invalid
-true
for invalid,false
for valid
-
isInvalid
default boolean isInvalid()Gets whether the component is currently in invalid state.- Specified by:
isInvalid
in interfaceHasValidation
- Returns:
true
for invalid,false
for valid
-