The sap.m.InputBase
control provides a basic functionality for input controls.
Constructor for a new sap.m.InputBase
.
Accepts an object literal mSettings
that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.
new sap.m.InputBase(sId?, mSettings?)
Param | Type | Default Value | Description |
---|---|---|---|
sId? | string | ID for the new control, generated automatically if no ID is given |
|
mSettings? | object | Initial settings for the new control |
Name | Type | Default Value | Description |
---|---|---|---|
editable | boolean | true | Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it. |
enabled | boolean | true | Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain. Visibility: public |
name | string | The name to be used in the HTML code (for example, for HTML forms that send data to the server via submission). Visibility: public |
|
placeholder | string | Defines a short hint intended to aid the user with data entry when the control has no value. Visibility: public |
|
required | boolean | false | Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation |
showValueStateMessage | boolean | true | Indicates whether the value state message should be shown or not. |
textAlign | sap.ui.core.TextAlign | Initial | Defines the horizontal alignment of the text that is shown inside the input field. |
textDirection | sap.ui.core.TextDirection | Inherit | Defines the text directionality of the input field, e.g. |
value | string | Defines the value of the control. Visibility: public |
|
valueState | sap.ui.core.ValueState | None | Visualizes the validation state of the control, e.g. |
valueStateText | string | Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle. |
|
width | sap.ui.core.CSSSize | Defines the width of the control. Note: If the provided width is too small, the control gets stretched to its min width, which is needed in order for the control to be usable and well aligned. Visibility: public |
Default Aggregation:
Name | Cardinality | Type | Description |
---|---|---|---|
_beginIcon | 0..n | sap.ui.core.Icon |
Icons that will be placed before the input field |
_endIcon | 0..n | sap.ui.core.Icon |
Icons that will be placed after the input field |
_invisibleFormattedValueStateText | 0..1 | sap.m.FormattedText |
Clone of the |
formattedValueStateText | 0..1 | sap.m.FormattedText |
Defines the formatted text that appears in the value state message pop-up. It can include links. If both |
Name | Cardinality | Type | Description |
---|---|---|---|
ariaDescribedBy | 0..n | sap.ui.core.Control |
Association to controls / IDs that describe this control (see WAI-ARIA attribute aria-describedby). |
ariaLabelledBy | 0..n | sap.ui.core.Control |
Association to controls / IDs that label this control (see WAI-ARIA attribute aria-labelledby). |
Event | Description |
---|---|
change |
Is fired when the text in the input field has changed and the focus leaves the input field or the enter key is pressed. |
Method | Description |
---|---|
addAriaDescribedBy |
Adds some ariaDescribedBy into the association ariaDescribedBy. |
addAriaLabelledBy |
Adds some ariaLabelledBy into the association ariaLabelledBy. |
addBeginIcon |
Adds an icon to the beginning of the input
|
addEndIcon |
Adds an icon to the end of the input
|
applyFocusInfo |
Applies the focus info. To be overwritten by subclasses. |
attachChange |
Attaches event handler When called, the context of the event handler (its Is fired when the text in the input field has changed and the focus leaves the input field or the enter key is pressed. |
bindValue |
Binds property value to model data. See ManagedObject.bindProperty for a detailed description of the possible properties of |
closeValueStateMessage |
Close value state message popup. |
destroyFormattedValueStateText |
Destroys the formattedValueStateText in the aggregation formattedValueStateText. |
detachChange |
Detaches event handler The passed function and listener object must match the ones used for event registration. |
sap.m.InputBase.extend |
Creates a new subclass of class sap.m.InputBase with name
|
fireChange |
Fires event change to attached listeners. |
fireChangeEvent |
Fires the change event for the listeners |
getAccessibilityInfo |
References:
|
getAriaDescribedBy |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy. |
getAriaLabelledBy |
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy. |
getDomRefForValueStateMessage |
Gets the DOM element reference where the message popup is attached. |
getEditable |
Gets current value of property editable. Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it. Default value is |
getEnabled |
Gets current value of property enabled. Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain. Default value is |
getFocusInfo |
Returns an object representing the serialized focus information. To be overwritten by subclasses. |
getFormattedValueStateText |
Gets content of aggregation formattedValueStateText. Defines the formatted text that appears in the value state message pop-up. It can include links. If both |
getLabels |
Gets the labels referencing this control. |
getLastValue |
Gets the last value of the InputBase |
sap.m.InputBase.getMetadata |
Returns a metadata object for class sap.m.InputBase. |
getName |
Gets current value of property name. The name to be used in the HTML code (for example, for HTML forms that send data to the server via submission). |
getPlaceholder |
Gets current value of property placeholder. Defines a short hint intended to aid the user with data entry when the control has no value. |
getRequired |
Gets current value of property required. Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation Default value is |
getSelectedText |
Retrieves the selected text. Only supported for input control's type of Text, Url, Tel and Password. |
getShowValueStateMessage |
Gets current value of property showValueStateMessage. Indicates whether the value state message should be shown or not. Default value is |
getTextAlign |
Gets current value of property textAlign. Defines the horizontal alignment of the text that is shown inside the input field. Default value is |
getTextDirection |
Gets current value of property textDirection. Defines the text directionality of the input field, e.g. Default value is |
getValue |
Gets current value of property value. Defines the value of the control. |
getValueDescriptionInfo |
Gets the value of the accessibility description info field. |
getValueState |
Gets current value of property valueState. Visualizes the validation state of the control, e.g. Default value is |
getValueStateText |
Gets current value of property valueStateText. Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle. |
getWidth |
Gets current value of property width. Defines the width of the control. Note: If the provided width is too small, the control gets stretched to its min width, which is needed in order for the control to be usable and well aligned. |
isComposingCharacter |
indicating if a character is currently composing. |
onChange |
Handles the change event. |
onValueRevertedByEscape |
Hook method that gets called when the input value is reverted with hitting escape. It may require to re-implement this method from sub classes for control specific behaviour. |
openValueStateMessage |
Open value state message popup. |
preventChangeOnFocusLeave |
Hook method to prevent the change event from being fired when the text input field loses focus. |
removeAllAriaDescribedBy |
Removes all the controls in the association named ariaDescribedBy. |
removeAllAriaLabelledBy |
Removes all the controls in the association named ariaLabelledBy. |
removeAriaDescribedBy |
Removes an ariaDescribedBy from the association named ariaDescribedBy. |
removeAriaLabelledBy |
Removes an ariaLabelledBy from the association named ariaLabelledBy. |
selectText |
Selects the text within the input field between the specified start and end positions. Only supported for input control's type of Text, Url, Tel and Password. |
setEditable |
Sets a new value for property editable. Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it. When called with a value of Default value is |
setEnabled |
Sets a new value for property enabled. Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain. When called with a value of Default value is |
setFormattedValueStateText |
Sets the aggregated formattedValueStateText. |
setLastValue |
Sets the last value of the InputBase |
setName |
Sets a new value for property name. The name to be used in the HTML code (for example, for HTML forms that send data to the server via submission). When called with a value of |
setPlaceholder |
Sets a new value for property placeholder. Defines a short hint intended to aid the user with data entry when the control has no value. When called with a value of |
setRequired |
Sets a new value for property required. Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation When called with a value of Default value is |
setShowValueStateMessage |
Sets a new value for property showValueStateMessage. Indicates whether the value state message should be shown or not. When called with a value of Default value is |
setTextAlign |
Sets a new value for property textAlign. Defines the horizontal alignment of the text that is shown inside the input field. When called with a value of Default value is |
setTextDirection |
Sets a new value for property textDirection. Defines the text directionality of the input field, e.g. When called with a value of Default value is |
setValue |
Setter for property Default value is empty/ |
setValueState |
Sets a new value for property valueState. Visualizes the validation state of the control, e.g. When called with a value of Default value is |
setValueStateText |
Sets a new value for property valueStateText. Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle. When called with a value of |
setWidth |
Sets a new value for property width. Defines the width of the control. Note: If the provided width is too small, the control gets stretched to its min width, which is needed in order for the control to be usable and well aligned. When called with a value of |
unbindValue |
Unbinds property value from model data. |
updateDomValue |
Sets the DOM value of the input field and handles placeholder visibility. |
Adds some ariaDescribedBy into the association ariaDescribedBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaDescribedBy | sap.ui.core.ID sap.ui.core.Control |
The ariaDescribedBy to add; if empty, nothing is inserted |
Adds some ariaLabelledBy into the association ariaLabelledBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaLabelledBy | sap.ui.core.ID sap.ui.core.Control |
The ariaLabelledBy to add; if empty, nothing is inserted |
Adds an icon to the beginning of the input
References:
Param | Type | DefaultValue | Description |
---|---|---|---|
oIconSettings | object |
settings for creating an icon |
Adds an icon to the end of the input
References:
Param | Type | DefaultValue | Description |
---|---|---|---|
oIconSettings | object |
settings for creating an icon |
|
iPosition | int |
position to be inserted in the aggregation. If not provided, the icon gets inserted on last position. |
Applies the focus info. To be overwritten by subclasses.
Param | Type | DefaultValue | Description |
---|---|---|---|
oFocusInfo | object |
Attaches event handler fnFunction
to the change event of this sap.m.InputBase
.
When called, the context of the event handler (its this
) will be bound to oListener
if specified, otherwise it will be bound to this sap.m.InputBase
itself.
Is fired when the text in the input field has changed and the focus leaves the input field or the enter key is pressed.
Param | Type | DefaultValue | Description |
---|---|---|---|
oData | object |
An application-specific payload object that will be passed to the event handler along with the event object when firing the event |
|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called when the event occurs |
|
oListener | object |
Context object to call the event handler with. Defaults to this |
Binds property value to model data.
See ManagedObject.bindProperty for a detailed description of the possible properties of oBindingInfo
Param | Type | DefaultValue | Description |
---|---|---|---|
oBindingInfo | sap.ui.base.ManagedObject.PropertyBindingInfo |
The binding information |
Destroys the formattedValueStateText in the aggregation formattedValueStateText.
Detaches event handler fnFunction
from the change event of this sap.m.InputBase
.
The passed function and listener object must match the ones used for event registration.
Param | Type | DefaultValue | Description |
---|---|---|---|
fnFunction | function(sap.ui.base.Event) : void |
The function to be called, when the event occurs |
|
oListener | object |
Context object on which the given function had to be called |
Creates a new subclass of class sap.m.InputBase with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.Control.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Fires event change to attached listeners.
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Parameters to pass along with the event |
|
value | string |
The new |
Fires the change event for the listeners
Param | Type | DefaultValue | Description |
---|---|---|---|
sValue | string |
value of the input. |
|
oParams | object |
extra event parameters. |
Returns array of IDs of the elements which are the current targets of the association ariaDescribedBy.
Returns array of IDs of the elements which are the current targets of the association ariaLabelledBy.
Gets current value of property editable.
Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.
Default value is true
.
Gets current value of property enabled.
Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.
Default value is true
.
Returns an object representing the serialized focus information. To be overwritten by subclasses.
Gets content of aggregation formattedValueStateText.
Defines the formatted text that appears in the value state message pop-up. It can include links. If both valueStateText
and formattedValueStateText
are set - the latter is shown.
Gets current value of property name.
The name to be used in the HTML code (for example, for HTML forms that send data to the server via submission).
Gets current value of property placeholder.
Defines a short hint intended to aid the user with data entry when the control has no value.
Gets current value of property required.
Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor
of sap.m.Label
) cannot be established (e.g. one label should label multiple fields).
Default value is false
.
Retrieves the selected text. Only supported for input control's type of Text, Url, Tel and Password.
Gets current value of property showValueStateMessage.
Indicates whether the value state message should be shown or not.
Default value is true
.
Gets current value of property textAlign.
Defines the horizontal alignment of the text that is shown inside the input field.
Default value is Initial
.
Gets current value of property textDirection.
Defines the text directionality of the input field, e.g. RTL
, LTR
Default value is Inherit
.
Gets current value of property valueState.
Visualizes the validation state of the control, e.g. Error
, Warning
, Success
.
Default value is None
.
Gets current value of property valueStateText.
Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.
Gets current value of property width.
Defines the width of the control.
Note: If the provided width is too small, the control gets stretched to its min width, which is needed in order for the control to be usable and well aligned.
Handles the change event.
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | object | ||
mParameters | object |
Additional event parameters to be passed in to the change event handler if the value has changed |
|
sNewValue | string |
Passed value on change |
Hook method that gets called when the input value is reverted with hitting escape. It may require to re-implement this method from sub classes for control specific behaviour.
Param | Type | DefaultValue | Description |
---|---|---|---|
sValue | string |
Reverted value of the input. |
Hook method to prevent the change event from being fired when the text input field loses focus.
Param | Type | DefaultValue | Description |
---|---|---|---|
oEvent | jQuery.Event |
The event object. |
Removes an ariaDescribedBy from the association named ariaDescribedBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaDescribedBy | int sap.ui.core.ID sap.ui.core.Control |
The ariaDescribedBy to be removed or its index or ID |
Removes an ariaLabelledBy from the association named ariaLabelledBy.
Param | Type | DefaultValue | Description |
---|---|---|---|
vAriaLabelledBy | int sap.ui.core.ID sap.ui.core.Control |
The ariaLabelledBy to be removed or its index or ID |
Selects the text within the input field between the specified start and end positions. Only supported for input control's type of Text, Url, Tel and Password.
Param | Type | DefaultValue | Description |
---|---|---|---|
iSelectionStart | int |
The index into the text at which the first selected character is located. |
|
iSelectionEnd | int |
The index into the text at which the last selected character is located. |
Sets a new value for property editable.
Defines whether the control can be modified by the user or not. Note: A user can tab to non-editable control, highlight it, and copy the text from it.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bEditable | boolean | true |
New value for property |
Sets a new value for property enabled.
Indicates whether the user can interact with the control or not. Note: Disabled controls cannot be focused and they are out of the tab-chain.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bEnabled | boolean | true |
New value for property |
Sets the aggregated formattedValueStateText.
Param | Type | DefaultValue | Description |
---|---|---|---|
oFormattedValueStateText | sap.m.FormattedText |
The formattedValueStateText to set |
Sets a new value for property name.
The name to be used in the HTML code (for example, for HTML forms that send data to the server via submission).
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sName | string |
New value for property |
Sets a new value for property placeholder.
Defines a short hint intended to aid the user with data entry when the control has no value.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sPlaceholder | string |
New value for property |
Sets a new value for property required.
Indicates that user input is required. This property is only needed for accessibility purposes when a single relationship between the field and a label (see aggregation labelFor
of sap.m.Label
) cannot be established (e.g. one label should label multiple fields).
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is false
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bRequired | boolean | false |
New value for property |
Sets a new value for property showValueStateMessage.
Indicates whether the value state message should be shown or not.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is true
.
Param | Type | DefaultValue | Description |
---|---|---|---|
bShowValueStateMessage | boolean | true |
New value for property |
Sets a new value for property textAlign.
Defines the horizontal alignment of the text that is shown inside the input field.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Initial
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTextAlign | sap.ui.core.TextAlign | Initial |
New value for property |
Sets a new value for property textDirection.
Defines the text directionality of the input field, e.g. RTL
, LTR
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is Inherit
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sTextDirection | sap.ui.core.TextDirection | Inherit |
New value for property |
Setter for property value
.
Default value is empty/undefined
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sValue | string |
New value for property |
Sets a new value for property valueState.
Visualizes the validation state of the control, e.g. Error
, Warning
, Success
.
When called with a value of null
or undefined
, the default value of the property will be restored.
Default value is None
.
Param | Type | DefaultValue | Description |
---|---|---|---|
sValueState | sap.ui.core.ValueState | None |
New value for property |
Sets a new value for property valueStateText.
Defines the text that appears in the value state message pop-up. If this is not specified, a default text is shown from the resource bundle.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sValueStateText | string |
New value for property |
Sets a new value for property width.
Defines the width of the control.
Note: If the provided width is too small, the control gets stretched to its min width, which is needed in order for the control to be usable and well aligned.
When called with a value of null
or undefined
, the default value of the property will be restored.
Param | Type | DefaultValue | Description |
---|---|---|---|
sWidth | sap.ui.core.CSSSize |
New value for property |