UI5-Text Field

lightUI5-Text Field

 

 


The post shows how to create and set different properties of Text Field(Input Field)

1


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”);

 


23


Case-2: Adding a default value to the text field

4


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”);


5


Case3: Field can be made editable- on and off.

6


7


Field- Editable Off

8


9


Field Enable and disable.

10


11


Field – Enable Off

12


13


Field Width ,required and change property.

With change property associating a function.

14


15


On Enter, the function triggered associated with change property.

16


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.

17


 

18


Enter text and hit enter. The entered text don’t match with the text’Hello’. So the state error sets the field as red.

19


Enter text and hit enter. The entered text  matches with the text’Hello’. So the state success sets the field as green.

20


The property live changes, reads the visible texts from the text field and mapped to teh text view field.

21


22


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s