Package io.jmix.flowui.component
Interface HasRequired
- All Superinterfaces:
com.vaadin.flow.component.HasElement,Serializable
- All Known Implementing Classes:
CodeEditor,EntityComboBox,EntityPicker,FileStorageUploadField,FileUploadField,FullTextFilter,JmixBigDecimalField,JmixCheckbox,JmixCheckboxGroup,JmixComboBox,JmixEmailField,JmixIntegerField,JmixMultiSelectComboBox,JmixMultiSelectComboBoxPicker,JmixMultiValuePicker,JmixNumberField,JmixPasswordField,JmixRadioButtonGroup,JmixSelect,JmixTextArea,JmixValuePicker,JpqlFilter,PropertyFilter,SingleFilterComponentBase,Switch,TwinColumn,TypedDatePicker,TypedDateTimePicker,TypedTextField,TypedTimePicker,WebdavDocumentUploadField
public interface HasRequired
extends com.vaadin.flow.component.HasElement
Interface that defines behavior for components that can be marked as required.
Provides methods to handle the required state and required messages for validation purposes.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.default booleanDetermines if the component is marked as required.default voidsetRequired(boolean required) Sets the required property for the component.voidsetRequiredMessage(String requiredMessage) Sets a message that will be displayed or logged when a required field or input is not provided.Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
Field Details
-
PROPERTY_REQUIRED
- See Also:
-
-
Method Details
-
isRequired
default boolean isRequired()Determines if the component is marked as required.- Returns:
trueif the component is required,falseotherwise
-
setRequired
default void setRequired(boolean required) Sets the required property for the component. When a component is marked as required, it indicates that a value must be provided for the component in order to pass validation.- Parameters:
required- a boolean value indicating whether the component is marked as required.trueto mark the component as required,falseotherwise.
-
getRequiredMessage
Returns the custom validation message to be displayed if the component is marked as required and the validation fails due to a missing value.- Returns:
- the required message set for the component, or
nullif no message is defined
-
setRequiredMessage
Sets a message that will be displayed or logged when a required field or input is not provided.- Parameters:
requiredMessage- the message to be set for required fields. Ifnull, the default message or no message will be used.
-