cancel
Showing results for 
Search instead for 
Did you mean: 

How can I Validate the Input fields in the UI of SAP Fiori App?

former_member1129777
Participant
0 Kudos

I am trying to Validate few input fields in the UI. like the Input field should accept only "Numbers", "alphanumeric", "only characters". Can any one guide on the UI Validations please in SAP Fiori App.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Lakshmi,

you can you attachBrowserEvent for vaidation of the input fields,

Like,

in view,


var oTextField = new sap.m.Input({

});

oTextField.attachBrowserEvent("keypress",oController.acceptOnlyNumerics);

in Controller,


acceptOnlyNumerics:function(event){

  var key_codes = [48,49,50,51,52,53,54,55,56,57];

   if (!($.inArray(event.which, key_codes) >= 0)) {

     event.preventDefault();

   }

  

  },