Skip to Content

Number Keypad in Mobile for sap.m.timepicker

Dear experts,
I am using sap.m.timepicker control to enter Time in a mobile application built using sapui5.
It is opening the normal alphanumeric keypad in mobile. The actual requirement is to open Numeric keypad as like when we use type = 'number' in sap.m.input.
Or any custom control can we use?

Kindly help to resolve this issue.



Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Dec 21, 2018 at 05:40 AM

    I reckon the number should have a capital N.

    at least that's the only difference I see between the code in the SDK and what you've put in the question.

    if that doesn't work share the code, that might give more insight into the issues that might be occurring


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Siddharth Shaligram ,

      Thanks for your response.
      type="Number" property in sap.m.Timepicker xml is really not making any change in behaviour of the timepicker control.

      As per this post Feature request: Number Keyboard sapMTimePicker , i tried changing the actual type of control by extending sap.m.timepicker control as below,"sap.m.TimePicker");"sap.m.TimePickerRenderer");
      sap.m.TimePicker.extend("com.Aricent.controls.TimePicker", {
      	renderer : "sap.m.TimePickerRenderer",
      	metadata : {
      		events : {
      			"_openPicker" : {}
         onAfterRendering : function() {
      		      // make sure that onAfterRendering function in Timpicker is not overwritten
      		       if(sap.m.TimePicker.prototype.onAfterRendering) {
      		    	  sap.m.TimePicker.prototype.onAfterRendering.apply(this, arguments);
       		      this._$input[0].type = "number";

      It made to open Numeric keyboard in mobile , but does not allowing to type anything.
      In desktop device if i tried to enter anything it gives me the below error.

      The specified value "--.--" is not a valid number. The value must match to the following regular expression: -?(\d+|\d+.\d+|.\d+)([eE][-+]?\d+)?

      Now in my case i must need to use the sap.m.Timepicker for its masking input behaviour and time input validation , the only issue is in mobile device it does not open Numeric keypad by itself, which is the mandat requirement now.

      Kindly help to resolve this.