Date Input
Overview
The Date Input component is a utility component used to input date. The user can enter the date manually or click on the calendar icon. When the user clicks on the calendar icon, the Calendar widget appears in the bottom sheet, and the user can select the date as required.
NOTE: The Date Input Component is used inside the Mobile Banking application.
Date Input Contracts
The Date Input component contains the following contracts.
- setData Method
- setReadOnly Method
- setReadWrite Method
- clearText Method
- setText Method
- setErrorText Method
- hideError Method
- getData Method
- getText Method
- getDateObject Method
- onBeginEditingCallback Event
- onEndEditingCallback Event
- onDoneCallback Event
- onTextChangeCallback Event
- onSelectionCallback Event
setData Method
This method is used to set the properties of the date input box in the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
|
|
Sample Input |
var data = {
"keyBoardStyle": constants.TEXTBOX_KEY_BOARD_STYLE_DEFAULT,
"placeholder": "Start Date",
"text": "03/20/1996",
"textInputMode": constants.TEXTBOX_INPUT_MODE_ANY,
"keyboardActionLabel": TEXTBOX_KEYBOARD_LABEL_DONE,
"errorText": "",
"dateFormat": "MM/DD/YYYY",
"startDate": [15, 02, 2022],
"endDate": [14, 02, 2023],
"disabledDates": [
[25, 03, 2022],
[25, 12, 2022]
],
"bottomSheetData": {
"title": "Select Start Date",
"description": "Please select a date for the calendar"
},
"onBeginEditingCallback": this.formFunc1,
"onEndEditingCallback": this.formFunc2,
"onDoneCallback": this.formFunc3,
"onTextChangeCallback": this.formFunc4,
"onClearCallback": this.formFunc5,
"isReadOnly": false
};
this.view.dateinput.setData(data);
|
|
Return Type |
None |
setReadOnly Method
This method is used to set the component in a read-only mode.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
this.view.dateinput.setReadOnly(); |
|
Return Type |
None |
setReadWrite Method
This method is used to enable the read-write mode of the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
this.view.dateinput.setReadWrite(); |
|
Return Type |
None |
clearText Method
This method is used to remove the user entered text from the input box.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
this.view.dateinput.clearText(); |
|
Return Type |
None |
setText Method
This method is used to set the text to the input box in the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
|
|
Sample Code |
var text = "This is a sample text"; this.view.dateinput.setText(text); |
|
Return Type |
None |
setErrorText Method
This method sets the error message to be displayed in the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
|
|
Sample Code |
var text = "This is a mandatory field"; this.view.dateinput.setErrorText(text); |
|
Return Type |
None |
hideError Method
This method is used to hide the error message in the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
this.view.dateinput.hideError(); |
|
Return Type |
None |
getData Method
This method is used to retrieve the data of the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
var data = {
"text": "31/01/1996",
"dateFormat": "MM/DD/YYYY",
"errorText": "Month cannot be greater than 12"
};
data = this.view.dateinput.getData();
|
|
Return Type |
A JSON object with the following key-value pairs.
|
getText Method
This method is used to retrieve the user entered text in the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
var text = "This is a sample text"; text=this.view.dateinput.getText(); |
|
Return Type |
|
getDateObject Method
This method is used to retrieve the information about the Date object of the component.
| Parameter | Value |
|---|---|
|
Syntax |
|
| Input parameter |
NA |
|
Sample Code |
var text = "This is a sample text"; text=this.view.animatingtextbox.getText(); |
|
Return Type |
This method returns a JSON object with the following keys.
|
onBeginEditingCallback Event
This event is triggered when the user starts entering text into the input box. When this event is triggered, the component executes the function set in the setData method. The parameter sent to the callback is the return object from the getDateObject method.
| Parameter | Value |
|---|---|
| Input parameter |
JSON object
|
| Programmatic Name | onBeginEditingCallback
|
|
Sample Code |
this.onBeginEditingCallback(dateData); |
|
Return Type |
NA |
onEndEditingCallback Event
The onEndEditingCallback event is triggered when the user has finished entering the text in the input box. This event is triggered when the user clicks on any of the following options.
- Another focusable widget on the screen such as TextBox.
- Done button on the Next-Previous bar.
- Done button on the soft keypad.
When this event is triggered, the component executes the function set in the setData method.
| Parameter | Value |
|---|---|
| Input parameter |
JSON object
|
| Programmatic Name | onEndEditingCallback
|
|
Sample Code |
this.onEndEditingCallback(dateData); |
|
Return Type |
NA |
onDoneCallback Event
This callback is triggered when the user clicks the enter key, Done key, or Go buttons in the soft keypad. When this event is triggered, the component executes the function set in the setData method.
| Parameter | Value |
|---|---|
| Input parameter |
JSON object
|
| Programmatic Name | onDoneCallback
|
|
Sample Code |
this.onDoneCallback(dateData); |
|
Return Type |
NA |
onTextChangeCallback Event
This event is triggered when the text inside the input box is modified. When this event is triggered, the component executes the function set in the setData method.
| Parameter | Value |
|---|---|
| Input parameter |
JSON object
|
| Programmatic Name | onTextChangeCallback
|
|
Sample Code |
this.onTextChangeCallback(dateData); |
|
Return Type |
NA |
onSelectionCallback Event
The onSelectionCallback event is triggered when the user clicks the Apply button in the BottomSheet after selecting a date from the calendar. When this event is triggered, the component executes the function set in the setData method.
| Parameter | Value |
|---|---|
| Input parameter |
JSON object
|
| Programmatic Name | onSelectionCallback
|
|
Sample Code |
this.onSelectionCallback(dateData); |
|
Return Type |
NA |
In this topic