on 03-04-2013 4:01 PM
Hello All,
I'm looking for a control like TextField in which I can anly enter numeric values (0123456789).
It does not seem the TextField control is able to do that.
Has anyone encountered this problem and has a solution? Or extended the TextField already for this purpose?
Any help will be appreciated.
regards,
Bert
Bert
One option would be to use the inbuilt functions of jQuery to check if the text field value is number or not. You can also use a expression to check if the field is numeric..
I used a in-built function, and it works decently
var oTextField = new sap.ui.commons.TextField({
id : "id", // sap.ui.core.ID
value : "", // string
required : true, // boolean
width : undefined, // sap.ui.core.CSSSize
maxLength : 10, // int
textAlign : sap.ui.core.TextAlign.Begin, // sap.ui.core.TextAlign
change : [ function(oEvent) {
//var control = oEvent.getSource();
var oID = oTextField.getValue();
if(isNaN(oID)){
alert("Not a number");
oTextField.setValueState(sap.ui.core.ValueState.Error);
}else{
alert("its a number");
}
}]
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.