Home > SharePoint 2010 > UK Phone numbers in InfoPath 2010

UK Phone numbers in InfoPath 2010

I was working with a client recently who wanted to be able to submit InfoPath forms with a UK style phone number field of 5 numeric+space+6numeric format, ‘01234 123456’.

I had to do a fair amount of looking around in InfoPath and the web , but finally came across a quite neat solution of pattern matching.

Firstly I had to make the text box accept the data type Text (string)

image

I then created a validation rule for the PhoneNumber control, for the condition I used “PhoneNumber” “does not match pattern”

image

and selected “Select a pattern…” in the final box, this brings up the Data Entry Pattern dialog box.

image

From this you can now choose “Custom pattern” I used  pattern \d\d\d\d\d \d\d\d\d\d\d to format my input.

image

With the addition of a screen tip  the validation rule is complete

image

Advertisement
Categories: SharePoint 2010 Tags:
  1. September 16, 2015 at 08:37

    Hi Neil, Some UK phone numbers have 3 digit STD and eight digit local number or 4 digit STD and 7 digit local number. Also perfectly reasonable to use brackets, e.g. (029) 2073 9000. And there are some areas of the country where numbers including STD are 10 digit, not the normal 11 digit. Most people today will look up numbers on their mobile which may well display the number as +442920739000 or +44(0)2920739000. etc, etc. Have you come across a way to allow all valid forms but still exclude truly invalid numbers?

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: