There is a common misconception about phone “numbers”. They aren’t numbers but symbols written with digits and every digit is significant, even leading zeroes.
The best form element would be a text box in order to keep leading zeroes. However, a text box will not enforce the restriction to digits nor the fixed-length phone number format. Hence, you should use a Formatted Field element (icon looking like a $
sign). Once created, right-click on it and Control Properties
. Scroll down to Formatting properties. Click on the ...
button to access the format definitions.
In the simplest case, under Number category, enter as many 0
as a phone number has digits in your country and set the number of leading zeroes equal to this number.
If you want some “decoration” in the numbers, such as spaces or dashes, create your own format code in the User-defined category. For instance for a North-American number enter "("000") "000"-"0000
.
Remember however this is only formatting of a number. A phone number may be very long (UIT standards say up to 15 digits) and this length may not be compatible with what can be understood as an integer within a floating-point number, compelling you to revert a string of characters.
To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!
In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.