UI5-Text Field
The post shows how to create and set different properties of Text Field(Input Field)
Put below code in between the start and end of second script tag
// Instantiate a new text field
oTextField = new sap.ui.commons.TextField({
name: “Field1”,
tooltip: “This is an input field help”,
}).placeAt(“content”);
Case-2: Adding a default value to the text field
Put below code in between the start and end of second script tag
// Instantiate a new text field
oTextField = new sap.ui.commons.TextField({
name: “Field1”,
tooltip: “This is an input field help”,
value: “Hello All”,
}).placeAt(“content”);
Case3: Field can be made editable- on and off.
Field- Editable Off
Field Enable and disable.
Field – Enable Off
Field Width ,required and change property.
With change property associating a function.
On Enter, the function triggered associated with change property.
With change property, the function checks whether the entered value is ‘Hello’ or not.
In case of mismatch, the state is set as error and in case of match a success state is set.
Enter text and hit enter. The entered text don’t match with the text’Hello’. So the state error sets the field as red.
Enter text and hit enter. The entered text matches with the text’Hello’. So the state success sets the field as green.
The property live changes, reads the visible texts from the text field and mapped to teh text view field.