Constraint for capturing telephone number in international notation

Dear All

Need some help with a constraint to force surveyor to enter a telephone
number in the following format with no spaces.

+27xxxxxxxxx e.g. +27116784567

Thanks

Bash

··· --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com

This would be a string field ( telephone numbers cannot fit in an int ).
Use an appearance="numbers"
http://opendatakit.org/help/form-design/examples/#numeric_string
to force the numeric keyboard.

constraint = " string-length(.) = 12 and regex(.,'^+27[0-9]+$') "

you might also be able to just do:

constraint = "regex(.,'^+27[0-9]{9}$')"

See http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
for the details.

··· On Thu, Jun 19, 2014 at 11:14 AM, Bashir Jahed wrote:

Dear All

Need some help with a constraint to force surveyor to enter a telephone
number in the following format with no spaces.

+27xxxxxxxxx e.g. +27116784567

Thanks

Bash


<http://www.avast.com/>

This email is free from viruses and malware because avast! Antivirus
http://www.avast.com/ protection is active.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Hi

I have tried both formats with no success. I have also tried the following with no success, my regex is very bad L

constraint = "regex(^(?:(?:(|)0|+27|27)(?:1[12345678]|2[123478]|3[1234569]|4[\d]|5[134678])(?:slight_smile: | |-|)\d{3}(?: |-|)\d{4}$)"

Dear All

Need some help with a constraint to force surveyor to enter a telephone number in the following format with no spaces.

+27xxxxxxxxx e.g. +27116784567 tel:%2B27116784567

Thanks

Bash

··· _____

http://www.avast.com/

This email is free from viruses and malware because avast! Antivirus http://www.avast.com/ protection is active.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com mailto:opendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


This email is free from viruses and malware because avast! Antivirus protection is active.

Bashir,

Mitch's regex works great for me.

The XML should look like:

This passes:
+27123456789

This doesn't:
+2712345678

You can confirm with http://rubular.com.

Yaw

··· -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Fri, Jun 20, 2014 at 4:16 AM, Bashir Jahed admin@osilab.net wrote:

Hi

I have tried both formats with no success. I have also tried the following
with no success, my regex is very bad L

constraint =
"regex(^(?:(?:(|)0|+27|27)(?:1[12345678]|2[123478]|3[1234569]|4[\d]|5[134678])(?:slight_smile:
| |-|)\d{3}(?: |-|)\d{4}$)"

Dear All

Need some help with a constraint to force surveyor to enter a telephone
number in the following format with no spaces.

+27xxxxxxxxx e.g. +27116784567

Thanks

Bash


http://www.avast.com/

This email is free from viruses and malware because avast! Antivirus
http://www.avast.com/ protection is active.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups..google.com/group/opendatakit?hl=en
http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


http://www.avast.com/

This email is free from viruses and malware because avast! Antivirus
http://www.avast.com/ protection is active.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks All

Got it to work, strange error with the actual spreadsheet I was using, I created a new form and it works, so will just transplant the info from broken excel file to new one.

Bash

··· From: opendatakit@googlegroups.com [mailto:opendatakit@googlegroups.com] On Behalf Of Yaw Anokwa Sent: 20 June 2014 02:31 PM To: ODK Community Subject: Re: [ODK Community] Constraint for capturing telephone number in international notation

Bashir,

Mitch's regex works great for me.

The XML should look like:

This passes:

+27123456789

This doesn't:

+2712345678

You can confirm with http://rubular.com.

Yaw

--

Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Fri, Jun 20, 2014 at 4:16 AM, Bashir Jahed admin@osilab.net wrote:

Hi

I have tried both formats with no success. I have also tried the following with no success, my regex is very bad L

constraint = "regex(^(?:(?:(|)0|+27|27)(?:1[12345678]|2[123478]|3[1234569]|4[\d]|5[134678])(?:slight_smile: | |-|)\d{3}(?: |-|)\d{4}$)"

Dear All

Need some help with a constraint to force surveyor to enter a telephone number in the following format with no spaces.

+27xxxxxxxxx e.g. +27116784567 tel:%2B27116784567

Thanks

Bash


http://www.avast.com/

This email is free from viruses and malware because avast! Antivirus http://www.avast.com/ protection is active.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com mailto:opendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com

Options: http://groups..google.com/group/opendatakit?hl=en http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


http://www.avast.com/

This email is free from viruses and malware because avast! Antivirus http://www.avast.com/ protection is active.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com mailto:opendatakit%2Bunsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups "ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


This email is free from viruses and malware because avast! Antivirus protection is active.