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

This method is used to set the properties of the date input box in the component.

Parameter Value

Syntax

this.view.<componentID>.setData(data);

Input parameter

data: JSON object containing the following key-value pairs to set the component preferences.

  • keyBoardStyle: Sets the keyboard style when entering text into the input box.
  • placeholder: Sets the filler text in the input box in a String format. This text animates to the top and becomes the title while entering the input.
  • text: The user entered text in the input box in a String format.
  • textInputMode: Specifies the input characters type of the input box.
  • keyboardActionLabel: Sets the text of the action label of the keyboard.
  • errorText: Sets the text of the Error label of the component in a String format.
  • dateFormat: Sets the date format to be entered in a String format. The value in this key also sets the placeholder of the date input box.
  • startDate: Sets the first valid date of the Calendar. The date must be provided in a {int[]} - [DD,MM,YYYY] integer array format.
  • endDate: Sets the last valid date of the Calendar. The date must be provided in a {int[]} - [DD,MM,YYYY] integer array format.
  • disabledDates: Sets the dates to be disabled even if they fall between the startDate and endDate. The date must be provided as an array in a {int[]} - [DD,MM,YYYY] integer array format.
  • bottomSheetData : This key accepts a JSON object with the following key-value pairs.
    • title: Sets the heading of the BottomSheet component used inside the component.
    • description: Sets the text as the description in the BottomSheet component used inside the component.
  • onBeginEditingCallback: Sets the callback function to be invoked when the onBeginEditing event of the component is triggered.
  • onEndEditingCallback: Sets the callback function to be invoked when the onEndEditing event of the component is triggered.
  • onDoneCallback: Sets the callback function to be invoked when the onDone event of the component is triggered.
  • onTextChangeCallback: Sets the callback function to be invoked when the onTextChange event of the component is triggered.
  • onSelectionCallback: Sets the callback function to be invoked when the onSelection event of the component is triggered.
  • isReadOnly: This parameter sets the read-only mode of the component. If the value of this parameter is true, the read-only mode of the component is enabled. If the value of this parameter is false, the read-write mode is enabled.

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

this.view.<componentID>.setReadOnly();

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

this.view.<componentID>.setReadWrite();

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

this.view.<componentID>.clearText();

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

this.view.<componentID>.setText(text);

Input parameter

text: Sets the text of the input box in a String format.

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

this.view.<componentID>.setErrorText(text);

Input parameter

text: Sets the error text in a String format.

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

this.view.<componentID>.hideError();

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

this.view.<componentID>.getData();

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.

  • text: The user-entered text in a String format.
  • dateFormat: Sets the date format to be entered in a String format. The value in this key also sets the placeholder of the date input box.
  • errorText: Sets the text to the Error label of the component in a String format.

getText Method

This method is used to retrieve the user entered text in the component.

Parameter Value

Syntax

this.view.<componentID>.getText();

Input parameter

NA

Sample Code

var text = "This is a sample text";
text=this.view.dateinput.getText();

Return Type

text: The user-entered text in a String format.

getDateObject Method

This method is used to retrieve the information about the Date object of the component.

Parameter Value

Syntax

this.view.<componentID>.getDataObject(text);

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.

  • isValid: Contains the status of the validity check of the user-entered date. If the date entered is valid, then the value in this parameter is true. If the date entered is not valid, then the value in this parameter would be false.
  • message: The status of the input. This key contains the error or success message text in a String format.
  • data: This key contains the Date object if the value in the isValid key is true. If the value in the isValid key is false, then this key contains a Null value.

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 dateData from the getDateObject method is the input. The dateData object contains the following keys.

  • isValid: Contains the status of the validity check of the user-entered date. If the date entered is valid, then the value in this parameter is true. If the date entered is not valid, then the value in this parameter would be false.
  • message: The status of the input. This key contains the error or success message text in a String format.
  • data: This key contains the Date object if the value in the isValid key is true. If the value in the isValid key is false, then this key contains a Null value.
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 dateData from the getDateObject method is the input. The dateData object contains the following keys.

  • isValid: Contains the status of the validity check of the user-entered date. If the date entered is valid, then the value in this parameter is true. If the date entered is not valid, then the value in this parameter would be false.
  • message: The status of the input. This key contains the error or success message text in a String format.
  • data: This key contains the Date object if the value in the isValid key is true. If the value in the isValid key is false, then this key contains a Null value.
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 dateData from the getDateObject method is the input. The dateData object contains the following keys.

  • isValid: Contains the status of the validity check of the user-entered date. If the date entered is valid, then the value in this parameter is true. If the date entered is not valid, then the value in this parameter would be false.
  • message: The status of the input. This key contains the error or success message text in a String format.
  • data: This key contains the Date object if the value in the isValid key is true. If the value in the isValid key is false, then this key contains a Null value.
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 dateData from the getDateObject method is the input. The dateData object contains the following keys.

  • isValid: Contains the status of the validity check of the user-entered date. If the date entered is valid, then the value in this parameter is true. If the date entered is not valid, then the value in this parameter would be false.
  • message: The status of the input. This key contains the error or success message text in a String format.
  • data: This key contains the Date object if the value in the isValid key is true. If the value in the isValid key is false, then this key contains a Null value.
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 dateData from the getDateObject method is the input. The dateData object contains the following keys.

  • isValid: Contains the status of the validity check of the user-entered date. If the date entered is valid, then the value in this parameter is true. If the date entered is not valid, then the value in this parameter would be false.
  • message: The status of the input. This key contains the error or success message text in a String format.
  • data: This key contains the Date object if the value in the isValid key is true. If the value in the isValid key is false, then this key contains a Null value.
Programmatic Name onSelectionCallback

Sample Code

this.onSelectionCallback(dateData); 

Return Type

NA

 

 

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 2, 2022 5:08:50 PM IST

Feedback
x