1090
Views
4
Comments
How to limit the number of input(Number) in a text box.
Question

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

2019-09-30 07-35-56
Aurelio Junior

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

UserImage.jpg
Pratik Raj

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.


2019-06-14 09-28-13
Seema Pandey

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


2022-12-28 01-16-29
Samuel Neves

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.