Single phone number can't be used for multiple primary contacts

We currently capture phone number of primary contact using Household Registration. What I have observed is that CHT restricts same phone number to be used on a different primary contacts. While this might sound logical, it restricts our CHVs from continuing with household registrations on the field.

Our CHVs have told us that some primary contacts do not have phone numbers. Hence, they ask the CHVs to save the phone number of the sheha ( head of the locality) who will then inform the client when a CHV wants to visit them or relay any info from CHV to client.

Therefore, can we drop the duplicate phone number check to fulfill this use case?

The tel type uses the phone widget which both validates the phone number’s format and ensures that no two contacts have the same phone number.

If we want to allow duplicate values, we can use a regular text/string field with a custom regex check to ensure that the telephone format is correct.
Example:

There is an open GitHub issue in cht-core to allow duplicate phone numbers while retaining phone number validation.

2 Likes

Hi Binod,

Thanks for the detailed explanation.

Is there a way to display only phone number pad when using this approach?

Yes, it’s possible by setting appearance for the field to numbers.

If I set appearance as numbers, I get an error message which I have set in the constraint message. In the pic below, I have two numbers. The primary phone works fine whereas secondary phone displays the constraint error message even when I add a valid phone number.

Can you please share what numbers are you trying? I can’t find any problem looking at the image of your form XLS. It works when I try with a similar form.
image

Hi Binod,

Here’s the screenshot. Notice that I have used the same digits in both input fields. The second field is rejecting it. This is the one with appearance = numbers.

That’s strange. Is it possible to share your XLS file using any file-sharing site?
Also please share any errors in the console and your test environment (CHT version, browser, OS).

CHT Version: 3.9.1
Browser: Chrome

Hey @iesmail, it looks like you’re violating the 9 digits constraint by using 10 instead.

The regex accepts a 0 followed by 9 digits. Isn’t it?

1 Like

Thanks for sharing your XLS form. It looks nice.

I have tested it in CHT 3.9.1 version using Chrome browser and the functionality is working fine for me.

image

Sorry, I am not sure what’s causing the problem at your end. Have you checked the browser console?

1 Like

Yes I have checked and I am not seeing any error messages.

I tried testing some random numbers and it seems like it accepts the following:

0888888888
0000000000
0111111111

Could it be possibly related to this? or this?

For a ‘numbers’ appearance, we render an input component of type number. It seems this strips leading zeros (which I believe is expected behaviour).

Would you be OK removing the numbers appearance? (like in the previous question in the form?)

We are on a dated enketo version but this may be resolved once we upgrade in a future cht-core release.