How to limit the number of input(Number) in a text box.

I am using Outsystems 10 and limit the number of input user give in text box by 29 digits.

Use the input's "Max. Length" property.

Aurelio Junior wrote:

Use the input's "Max. Length" property.

Thanks a lot, Max. Length option is coming when the input type is text but not when input type is number.


Pratik Raj wrote:

I am using Outsystems 10 and limit the number of input user give in text box by 29 digits.

Hi Pratik,

Please take a look at this discussion.

https://www.outsystems.com/forums/discussion/33623/javascript-to-detect-enter-key-press-in-mobile-app/#Post117418

Regards

Seema Pandey


Hi, Pratik

You could use the text input with the max length property and a jscript running onKeyDown blocking anything that's not a number. Something like this could work:

function PreventAlphabet() {
    var key = event.which || eventkeyCode
   
    if(key > 64 && key < 91){
        event.preventDefault();
    }
};

What it's doing is preventing the insertion of characters from A to Z and a to z, using their unicodes.