phone number field automatically removes leading zero

Hi,


I have the following issue:

I have a custom mask on a field.

The field is a phone number field.

However the mask only works on fields of input text.

This means that on mobile devices the numers pad does not show up automatically since the device thinks it is a text field.

Setting the field to number without the mask ( I can create a mask with jQuery myself later) gives the following behaviour:

The length is set to ten. the user types in 06123456789 (11 digits) then the leading zero is removed and the field shows: 6123456789.


How can I have a normal numbers field where a user can fill in a phonenumber via the numbers keypad.

Solution

Hello Edwin,

If you are doing an WEB application, you can add to the input in the Extended Properties section, the property Type, with the value "tel".

This will bring the numerical pad when you focus on it. 

At least on my Android it works (I don't know if it works on other devices)

But I don't know how this will play with the Custom Masks, but probably there will be no problems. You can try it.
If it is a mobile app, you can select the type to Tel in the properties of the input.

Hope this helps.

Cheers
Eduardo Jauch

Solution

Great! this works.

Bit strange though that the property of the field for type is text and that I have to set a property of type with a value of 'tel' to make it work. One overrules the other... Thanks for your help

Edwin Vriesman wrote:

Great! this works.

Bit strange though that the property of the field for type is text and that I have to set a property of type with a value of 'tel' to make it work. One overrules the other... Thanks for your help

Glad it worked :)

Cheers,
Eduardo Jauch

Eduardo Jauch wrote:

Hello Edwin,

If you are doing an WEB application, you can add to the input in the Extended Properties section, the property Type, with the value "tel".

This will bring the numerical pad when you focus on it. 

At least on my Android it works (I don't know if it works on other devices)

But I don't know how this will play with the Custom Masks, but probably there will be no problems. You can try it.
If it is a mobile app, you can select the type to Tel in the properties of the input.

Hope this helps.

Cheers
Eduardo Jauch


What is this type tel?

Im facing problems with mask number, i am using input mask mobile for number in my mobile aplication, the problem is, i write on the input example: 22,00 then on the db he saves as 22 and when i get back to the page the input receives the 22 and the input stays 0,22... Another example its me putting 2,20 and when he gets back stays 0,22 too...

Its urgent, waiting, appreciate!

Eduardo, I know this is far too old but for future readers. If the tel type doesn't work, remember the old school data rule: "If you're not going *MATH* on the field (or its not an auto-increment db key), don't use a numeric type. Leading zeros are getting removed by outsystems (and most platforms) because that's how numbers work. Number codes, phone #s, SSN, don't use numeric. (usually use text type, but of the platform supports types like phone/ssn, etc try those). 

Not following this causes tons of bugs and workarounds. People argue about it too :-) seems pretty simple to me but I can get the mistake as its not too intuitive: 'hey it's a NUMBER why not use integer, decimal, etc?'

Hello Alan

There is a difference between the Input and the Variable associated with it, that will store the information.
The input is always TEXT, and it is converted to the Datatype of the variable when submitting.

If you change the Input type, what you are doing is not changing what the input stores (text), but only how the browser allows you to interact with it. For example, if you set the input is of type "numeric", it will allow you only valid numeric characters. 

But what you type is still kept as a string, and it will be converted to the variable datatype when submitting. If your variable is of type text, any lead zeroes are kept.

The question here was to allow the user to use the Numeric keypad to enter the information, not how to store it.

Of course, a Phone Number, even if accepts only "numbers", is not numeric information. So, you're absolutely right on your affirmation. If the information is not numeric, you shouldn't use a numeric data type to store the information.

Cheers.