on 05-19-2015 9:37 AM
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.
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();
}
},
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.