Number constraints - KoboCollect App in Android

Hi,

I’m trying to constraint the answer to a question for a phone number for only numbers and no letters or special characters. I don’t want to limit how many digits the user can enter. I have used this constraint: regex(., ‘[0-9]’)

When I test is using a browser, the constraint works well. However, when I test it using the KoboCollect App, I can only enter one digit, not more.

Did anyone else face similar issue? And could you please suggest a solution?

Many thanks,
Ramzy

Hello Ramzy_icc,

Use this constraint regex(., '^[0-9]{10} or regex(., '^\d{10})`, which Restrict mobile number to ten digits only.

Hope this works.

Dinesh Dongol

1 Like

Hi Dinesh,

I do not want to restrict the mobile number to 10 digits. I want it to remain open for as many number of digits. The form is designed to collect information from participants located in different countries with different lengths of their phone number digits.

Let me know if you can help with that. The real issue is that I can enter as many numbers as I want when I use a bowser to fill in the form, but when I use the KoboCollect app, I am only restricted to one digit. I am not sure why there is a discrepancy between the app and the browser.

Best,
Ramzy

I guess you can use just question type as " integer" in this way there is no need to use regex.

This will allow numbers only.

And also please go through the following link; it might be helpful for you.

https://support.kobotoolbox.org/restrict_responses.html

Regards,
Dinesh Dongol

1 Like

You can try to use a text type for this phone number question but with appearance as “numbers” .

1 Like

@DatamaniacSteve, @Dnes :bowing_man: :pray:

Welcome @ramzy_icc,
often the search function of this forum and the Help Center articles can provide help and examples, see e.g.

Hint: Don’t forget to always check your form with the Online validator, please, during development and before employment,

1 Like