Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 766
  • Last Modified:

national and international phone number input mask

I've got a situation where I need to be able to switch back and forth on a form control between a national and an international input mask for phone numbers. I'm not sure how to approach it. I remember reading an article about doing just this but can't for the life of me remember the source or the approach.
0
eliwil
Asked:
eliwil
  • 3
  • 2
1 Solution
 
rockiroadsCommented:
Is it something like this

!\(999") "000\-0000;0;_


If u want international, u put in the prefix for that in front of it
0
 
eliwilAuthor Commented:
how would you go about changing the input mask? what would you use as a trigger? how would you present the choice to the user? looking for ideas?

E
0
 
eliwilAuthor Commented:
make that, I'm looking for ideas.
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
eliwilAuthor Commented:
Just did a search and came up with the following:

Title: Turn off input mask via coding

I think this will do the trick for me.

E
0
 
rockiroadsCommented:
How to do in code,

I think u found something,

But here is one way to set the input mask

Using the mask Ive supplied, since it contains double quotes we have to include them another way

e.g.

    txtPhoneNo.InputMask = "!\(999" & Chr$(34) & ") " & Chr$(34) & "000\-0000;0;_"


0
 
Jeffrey CoachmanMIS LiasonCommented:
eliwil,

Got this from somewhere... don't remember... hope it helps!
:)

If/Then/Else/End If, InputMask, Or, Value
You need a variable Input Mask for telephone numbers. If the client is from Canada or USA, the Input Mask would force "(514) 257-0734" but if the client is from Europe, you don't want any input mask". In the Event "Get Focus" of the telephone number text box, You will write this code:
    If countryField.Value = "Canada" or countryField.Value = "USA" Then
        telephoneNumberField.InputMask = "!\(999) 000-0000;0;_"
    Else
        telephoneNumberField.InputMask = ""
    End If


Bsically you change the mask based on the country.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now