Skip to Content
0

Validating sap.m.input gets focus out of that field

Oct 18, 2016 at 11:42 AM

21

avatar image

Hi all,

I am trying to validate an input field. I need to accept only positive integer values.

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco}
span.s1 {color: #931a68}
span.s2 {color: #3933ff}
  onInputChange: function(evt) {

        var val = evt.getSource().getValue();

        if (isNaN(val)){

        val = val.match(/^-?\d+\.?\d*$/);

        }

        evt.getSource().setValue(val);

    }

Actually this works fine for me except when user enters a single character, input field loses the focus. Does anybody have a solution about this.

Thanks in advance,

Kerem

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers