I am using tel
question type for the phone field. I am using this regex regex(.,'^0[0-9]{9}$')
as a constraint. However, when I input for instance, 0777123456
, it does not accept the value. Here’s the xls form.
tel
is a special field for the app forms in CHT that:
- rejects numbers that match the
phone
field on an existing contact - rejects if they are not valid phone numbers for the server’s configured
default_country_code
(as determined by the google-libphonenumber library)
If you can rely on regex alone, you can use string
or text
instead of tel
.
Starting with 4.11.0, phone number input is getting more flexible. You can read more about it here.
2 Likes
+1 to everything @binod said! One more bit of context is that the “ODK spec” way of collecting phone numbers is to use a text
question with the numbers
appearance. From my testing, the numbers
appearance does not actually limit what characters can be entered into the text box (you can still use your constraint for that), but on mobile devices it will cause the numbers keyboard to be displayed when the field is highlighted (instead of the normal alphabet keyboard).
2 Likes