Phone number constraint

I used RegEx to limit phone numbers to 11 digits, it works perfectly fine while filling questionnaires on the laptop but it does not allow me more than 9 digits on the phone.
Similarly, i limit the age to 99, it works well on a laptop but while filling form on a phone, the constraint is not applied. please advise.
i used regex(., ‘^\d{10}$’)

Welcome to the community, @hamidmumtaz! Your question type should be text and the appearance should be numbers to make it effectively work.

1 Like

Thanks Kal. it works now

1 Like

Welcome @hamidmumtaz,
For integer variables (up to 9 digits), e.g. age you can use simple constraints like . <99 and . >0
See also the Help Center articles

Also, be aware that there is an essential difference in the behaviour of regex between Enketo (webform) and Collect, see

For consistent behaviour, better use always ^ at the beginning of the regex pattern.

2 Likes

thanks Wroos. very helpfull

1 Like