Animating Textbox

Overview

The Animating Textbox component is a utility component that takes users' inputs. The Animating TextBox component provides methods to set the various properties of an input box such as text, placeholder, enable masking, restrict characters, and actions to be performed when the input is entered or cleared.

NOTE: The Animating Textbox Component is used inside the Mobile Banking application.

Animating Textbox Contracts

The Animating Textbox component contains the following contracts.

setData Method

This method sets the properties of the input box in the Animating Textbox 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.

  • isMasked: Boolean value to enable masking user-entered characters in the input box.
  • currencySymbol: Sets the symbol that appears before the currency.
  • amountPlaceholder: Sets the filler text that appears in the Amount input field.
  • keyBoardStyle: Sets the keyboard style when entering text into the input box.
  • isCurrency: When the value of this key is true, the component renders the currency symbol, sets the amountPlaceholder, and does not animate the placeholder label widget to the title position when the user enters the data. When the value of this field is false, the component behaves like a normal Animating TextBox component.
  • 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.
  • maxTextLength: Sets the maximum number of characters allowed in the input box.
  • restrictCharactersSet: Sets the collection of characters that the user cannot enter in the input box in a String format. If the user enters any of these characters, the character is removed automatically from the input box.
  • text: The user-entered text 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.
  • onBeginEditingCallback: Sets the callback function to be invoked when the onBeginEditing event of the textbox of the component is triggered.
  • onEndEditingCallback: Sets the callback function to be invoked when the onEndEditing event of the textbox of the component is triggered.
  • onDoneCallback: Sets the callback function to be invoked when the onDone event of the textbox of the component is triggered.
  • onTextChangeCallback: Sets the callback function to be invoked when the onTextChange event of the textbox of the component is triggered.
  • onClearCallback: Sets the callback function to be invoked when the onClear event of the textbox 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 = {
	"isMasked": false,
	"currencySymbol": "$"
	"amountPlaceholder": "0.00"
	"keyBoardStyle": constants.TEXTBOX_KEY_BOARD_STYLE_DEFAULT,
	"isCurrency": true,
	"placeholder": "Amount",
	"maxTextLength": 19,
	"restrictCharactersSet": "~#^|$%&*!",
	"text": "123.00",
	"textInputMode": constants.TEXTBOX_INPUT_MODE_ANY,
	"keyboardActionLabel": TEXTBOX_KEYBOARD_LABEL_DONE,
	"errorText": "",
	"onBeginEditingCallback": this.formFunc1,
	"onEndEditingCallback": this.formFunc2,
	"onDoneCallback": this.formFunc3,
	"onTextChangeCallback": this.formFunc4,
	"onClearCallback": this.formFunc5,
	"isReadOnly": false
};
this.view.animatingtextbox.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.animatingtextbox.setReadOnly();

Return Type

None

setReadWrite Method

This method enables the read-write mode of the component.

Parameter Value

Syntax

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

Input parameter

NA

Sample Code

this.view.animatingtextbox.setReadWrite();

Return Type

None

clearText Method

This method removes the user entered text from the input box.

Parameter Value

Syntax

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

Input parameter

NA

Sample Code

this.view.animatingtextbox.clearText();

Return Type

None

setText Method

This method sets 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.animatingtextbox.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.animatingtextbox.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.animatingtextbox.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: "john.doe@temenos.com",
	isMasked: false,
	placeholder: "Email ID",
	textInputMode: constants.TEXTBOX_INPUT_MODE_ANY,
};
data = this.view.animatingtextbox.getData();

Return Type

A JSON object with the following key-value pairs.

  • text: The user-entered text in a String format.
  • isMasked: Boolean value to enable masking user-entered characters in 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.
  • textInputMode: Specifies the input characters type of the input box.

getText Method

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

Parameter Value

Syntax

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

Input parameter

NA

Sample Code

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

Return Type

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

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.

Parameter Value
Input parameter

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

Programmatic Name onBeginEditingCallback

Sample Code

this.onBeginEditingCallback(text); 

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

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

Programmatic Name onEndEditingCallback

Sample Code

this.onEndEditingCallback(text); 

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

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

Programmatic Name onDoneCallback

Sample Code

this.onDoneCallback(text); 

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

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

Programmatic Name onTextChangeCallback

Sample Code

this.onTextChangeCallback(text); 

Return Type

NA

onClearCallback Event

This callback is triggered when the user clicks the clear button of the component. When this event is triggered, the component executes the function set in the setData method.

Parameter Value
Input parameter

NA

Programmatic Name onClearCallback

Sample Code

this.onClearCallback(); 

Return Type

NA

 

 

Copyright © 2020- Temenos Headquarters SA

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

Feedback
x