Package com.vaadin.flow.component.shared
Interface HasAllowedCharPattern
-
- All Superinterfaces:
HasElement
,Serializable
- All Known Implementing Classes:
AbstractNumberField
,ComboBox
,ComboBoxBase
,DatePicker
,EmailField
,IntegerField
,MultiSelectComboBox
,NumberField
,PasswordField
,TextArea
,TextField
,TimePicker
public interface HasAllowedCharPattern extends HasElement
Mixin interface for field components that support setting allowed char pattern to prevent user from entering invalid characters when typing or pasting text.- Author:
- Vaadin Ltd
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default String
getAllowedCharPattern()
A regular expression that the user input is checked against.default void
setAllowedCharPattern(String pattern)
Sets a regular expression for the user input to pass on the client-side.-
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
-
-
-
-
Method Detail
-
getAllowedCharPattern
default String getAllowedCharPattern()
A regular expression that the user input is checked against. The allowed pattern must matches a single character, not the sequence of characters.- Returns:
- the
allowedCharPattern
property
-
setAllowedCharPattern
default void setAllowedCharPattern(String pattern)
Sets a regular expression for the user input to pass on the client-side. The allowed char pattern must be a valid JavaScript Regular Expression that matches a single character, not the sequence of characters.For example, to allow entering only numbers and slash character, use
setAllowedCharPattern("[0-9/]")
`.- Parameters:
pattern
- the String pattern to set
-
-