Setting maxlength for number datatype.

Setting maxlength for number datatype.

  

Hi all, How to apply maxlength for number datatype in mobile application.

Ellakkiya Selvadurai wrote:

Hi all, How to apply maxlength for number datatype in mobile application.You 

You can follow this link...
https://www.outsystems.com/forums/discussion/27816/mobile-max-length-of-input-not-working/

Khandakar Tareq wrote:

Ellakkiya Selvadurai wrote:

Hi all, How to apply maxlength for number datatype in mobile application.You 

You can follow this link...
https://www.outsystems.com/forums/discussion/27816/mobile-max-length-of-input-not-working/

Thankyou for your reply, but I need more clarification.....




Please.

Explain what you are trying to achieve.

Cheers.

Eduardo Jauch wrote:

Please.

Explain what you are trying to achieve.

Cheers.


I am trying to set the max length for an input widget which has the datatype as number...

In the attributes section you can add the max and min attributes, that will define the minimum and maximum VALUE you can enter, or, as usually is best, you validate your variable before trying to use it, and warn the user if the value he entered is invalid.

If you are entering only simple integers and really want to limit the number of digits the user enters, you can set the input to Tel and it will allow you to set the maxLenght property.

Other than that only through JavaScript.

Cheers.

Eduardo Jauch wrote:

In the attributes section you can add the max and min attributes, that will define the minimum and maximum VALUE you can enter, or, as usually is best, you validate your variable before trying to use it, and warn the user if the value he entered is invalid.

If you are entering only simple integers and really want to limit the number of digits the user enters, you can set the input to Tel and it will allow you to set the maxLenght property.

Other than that only through JavaScript.

Cheers.

Thankyou for your reply


Eduardo Jauch wrote:

In the attributes section you can add the max and min attributes, that will define the minimum and maximum VALUE you can enter, or, as usually is best, you validate your variable before trying to use it, and warn the user if the value he entered is invalid.

If you are entering only simple integers and really want to limit the number of digits the user enters, you can set the input to Tel and it will allow you to set the maxLenght property.

Other than that only through JavaScript.

Cheers.


Thankyou for your reply.,

How it can be achieved through Javascript. I have used the Javascript on onready function.

You have to capture the key pressed (and the way for doing this may be different depending on the device) and check if the length of the string is at the limit and just ignore the key pressed.

Please, take a look at this discussion.

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

Cheers.