How do we collect telephone numbers which start with a leading zero?

Hello

How do we collect telephone numbers which start with a leading zero without stripping out the initial zero and saving the value with the zero at the beginning.

We also want to be able to confirm phone number provided earlier which means that phone numbers in a second textbox should match the previous one. How do we achieve that. Any help please?

Welcome to the community @ekua! Maybe this post discussed previously should help you solve your issue:

For details, please also feel free to visit our support article Restricting Text Responses With Regular Expressions to learn more on regex.


We tried this for the number of digit and it work but now we want the first digit to start with zero eg 024

Could you share with us a sample of the number format. Maybe we could help you with the same.

Ghanaian phone numbers have ten digits eg. 0244310243. We want all the digits to appear beginning with the initial zero

There should be an error notification when u do not start with zero

So you mean 024 should be entered by default and then 7 additional digit should also be supplied?

Depending on the network the first 3 numbers after the zero may change but the initial 0 is constant eg 0-244-321456

OK, so you could do the same as outlined in the image shared below:

In the survey tab of your xlsform:

If you are using the form builder UI:

You could do it as shown in the image below:

Data entry screen as seen in Enketo: (when a wrong entry is made)

Image 2

Data entry screen as seen in Enketo: (when a correct entry is made)

Image 3

Reference xlsform:

Regex_Constraint.xlsx (10.0 KB)

Seems not to work in kobocollect tool

The question type should be in text and the appearance should be numbers.

What is the appearance please

Maybe this should help you …

1 Like

Hurray. It worked! Thanks for the input ! 20210204_163509|690x388

1 Like

We also want to be able to confirm phone number provided earlier which means that phone numbers in a second textbox should match the previous one. How do we achieve that. Any help please?

You could follow this workaround discussed previously (it should solve your issue):

IMG-20210205-WA0009 **Data entry screen as seen in Kobocollect toolbox: (when a wrong entry is made)

IMG-20210205-WA0008
Data entry screen as seen in kobo toolbox: (when a correct entry is made)

1 Like

Thank you for the guidance

1 Like

Hello so a follow up to that, we expect 2 phone number responses in the survey, I.e. a primary number and a secondary number of which we intend to do some mobile cash transfers with the registered phone number (could either be the primary or secondary number). We have managed to do the confirmation for the primary number as the “Momo number” ( registered cash transfer number) but are heaving difficulty linking the secondary number in the case that that is the respondent’s registered number. We need to get the exact secondary number as momo number. Kindly assist