Class sap.m.MaskInputModule: sap/m/MaskInput

extends InputBase
known direct subclasses: TimePicker

The sap.m.MaskInput control allows users to easily enter data in a certain format and in a fixed-width input (for example: date, time, phone number, credit card number, currency, IP address, MAC address, and others).


Since: 1.34.0.
Constructor Summary
new sap.m.MaskInput(sId?, mSettings?)Constructor for a new MaskInput.
Fields borrowed from class sap.m.InputBase
Events borrowed from class sap.m.InputBase
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.MaskInput.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.MaskInput with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.MaskInput.getMetadata()Returns a metadata object for class sap.m.MaskInput.
_feedReplaceChar(sChar, iPlacePosition, sCurrentInputValue)Gets a replacement string for the character being placed in the input.
_isCharAllowed(sChar, iIndex)Verifies whether a character at a given position is allowed according to its mask rule.
addRule(oRule)Adds some rule to the aggregation rules.
destroyRules()Destroys all the rules in the aggregation rules.
getMask()Gets current value of property mask.
getPlaceholderSymbol()Gets current value of property placeholderSymbol.
getRules()Gets content of aggregation rules.
indexOfRule(oRule)Checks for the provided sap.m.MaskInputRule in the aggregation rules.
insertRule(oRule, iIndex)Inserts a rule into the aggregation rules.
removeAllRules()Removes all the controls from the aggregation rules.
removeRule(vRule)Removes a rule from the aggregation rules.
setValue(sValue)Setter for property value.
Constructor Detail
new sap.m.MaskInput(sId?, mSettings?)
Constructor for a new MaskInput.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject for a general description of the syntax of the settings object.

The supported settings are:

In addition, all settings applicable to the base type sap.m.InputBase can be used as well.

Parameters:
{string}sId? ID for the new control, generated automatically if no ID is given
{object}mSettings? Initial settings for the new control
Method Detail
sap.m.MaskInput.extend(sClassName, oClassInfo?, FNMetaImpl?): function
Creates a new subclass of class sap.m.MaskInput with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.m.InputBase.extend.

Parameters:
{string}sClassName Name of the class being created
{object}oClassInfo? Object literal with information about the class
{function}FNMetaImpl? Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
{function} Created class / constructor function
sap.m.MaskInput.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.MaskInput.
Returns:
{sap.ui.base.Metadata} Metadata object describing this class
_feedReplaceChar(sChar, iPlacePosition, sCurrentInputValue): String
Gets a replacement string for the character being placed in the input. Subclasses may override this method in order to get some additional behavior. For instance, switching current input character with other for time input purposes. As an example, if the user enters "2" (in 12-hour format), the consumer may use this method to replace the input from "2" to "02".
Parameters:
{String}sChar The current character from the input
{int}iPlacePosition The position the character should occupy
{string}sCurrentInputValue The value currently inside the input field (may differ from the property value)
Returns:
{String} A string that replaces the character
_isCharAllowed(sChar, iIndex)
Verifies whether a character at a given position is allowed according to its mask rule.
Parameters:
{String}sChar The character
{int}iIndex The position of the character
addRule(oRule): sap.m.MaskInput
Adds some rule to the aggregation rules.
Parameters:
{sap.m.MaskInputRule}oRule the rule to add; if empty, nothing is inserted
Returns:
{sap.m.MaskInput} Reference to this in order to allow method chaining
destroyRules(): sap.m.MaskInput
Destroys all the rules in the aggregation rules.
Returns:
{sap.m.MaskInput} Reference to this in order to allow method chaining
getMask(): string
Gets current value of property mask.

Mask defined by its characters type (respectively, by its length). You should consider the following important facts: 1. The mask characters normally correspond to an existing rule (one rule per unique char). Characters which don't, are considered immutable characters (for example, the mask '2099', where '9' corresponds to a rule for digits, has the characters '2' and '0' as immutable). 2. Adding a rule corresponding to the placeholderSymbol is not recommended and would lead to an unpredictable behavior. 3. You can use the special escape character '^' called "Caret" prepending a rule character to make it immutable. Use the double escape '^^' if you want to make use of the escape character as a immutable one.

Returns:
{string} Value of property mask
getPlaceholderSymbol(): string
Gets current value of property placeholderSymbol.

Defines a placeholder symbol. Shown at the position where there is no user input yet.

Default value is _.

Returns:
{string} Value of property placeholderSymbol
getRules(): sap.m.MaskInputRule[]
Gets content of aggregation rules.

A list of validation rules (one rule per mask character).

Returns:
{sap.m.MaskInputRule[]}
indexOfRule(oRule): int
Checks for the provided sap.m.MaskInputRule in the aggregation rules. and returns its index if found or -1 otherwise.
Parameters:
{sap.m.MaskInputRule}oRule The rule whose index is looked for
Returns:
{int} The index of the provided control in the aggregation if found, or -1 otherwise
insertRule(oRule, iIndex): sap.m.MaskInput
Inserts a rule into the aggregation rules.
Parameters:
{sap.m.MaskInputRule}oRule the rule to insert; if empty, nothing is inserted
{int}iIndex the 0-based index the rule should be inserted at; for a negative value of iIndex, the rule is inserted at position 0; for a value greater than the current size of the aggregation, the rule is inserted at the last position
Returns:
{sap.m.MaskInput} Reference to this in order to allow method chaining
removeAllRules(): sap.m.MaskInputRule[]
Removes all the controls from the aggregation rules.

Additionally, it unregisters them from the hosting UIArea.

Returns:
{sap.m.MaskInputRule[]} An array of the removed elements (might be empty)
removeRule(vRule): sap.m.MaskInputRule
Removes a rule from the aggregation rules.
Parameters:
{int|string|sap.m.MaskInputRule}vRule The ruleto remove or its index or id
Returns:
{sap.m.MaskInputRule} The removed rule or null
setValue(sValue): sap.m.MaskInput
Setter for property value.
Parameters:
{string}sValue New value for property value.
Returns:
{sap.m.MaskInput}this to allow method chaining.