How can I write a phone number without leading zeros, restricting it to 10 digits, are there any enhancement plans or constraint field code
For example: 5555555555
You can add a constraint to the field. An example that esri gives is setting the constraint column to the following for phone numbers:
string-length(.)>=8 and string-length(.)<=12
You can also use a regex expression. Here's the suggestion from esri for emails for example (it won't let me paste it directly here so here's a screenshot):
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Cheatsheet is a link to more information on how to formulate regex expressions
You can also try for the phone number: regex([0-9]{10}) which will limit it to 10 digits not just the string length
sorry, you will need to change the syntax a little. The regular expression (regex) should include a (.,'()') for survey123 constraint so:
regex(.,'^([0-9]{3})(-)([0-9]{3})(-)([0-9]{4})$') if you want dashes
regex(.,'^([0-9]{10})$') if you don't
Thank you so much. I think I understand.
I try,
regex(.,'^(?!0)[0-9]{10}$') if you correct syntax?
Looks good to me. Test it out.