• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to deal with phone numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to deal with phone numbers


  • Subject: Re: How to deal with phone numbers
  • From: David LeBer <email@hidden>
  • Date: Wed, 16 Mar 2005 10:57:29 -0500

On Mar 16, 2005, at 10:13 AM, Jeremy Matthews wrote:

Ok,

The three scenarios I can imagine when dealing with phone/fax numbers...

1) Create fields for each set of digits (e.g., field for area code, for the second set of digits, and another for the third) and limit input by number of characters in those entry fields within the form
2) Create a single, long text field that performs a check prior to the EC saving to the DB, and warn the user to reformat in a specific pattern (i.e., xxx-xxx-xxxx)
3) Create a text field and do not attempt to restrict/control, and reformat during the DB save

So far all of my applications have only required accepting North American phone numbers (3 + 3 + 4). I usually use option number 3.


A little bit of regex to strip the non numeric string values out, and then you can just validate by checking if it is a 10 character string.

Similarly, a little bit of regex to reformat for display on the way back out again. (String.replaceAll() is a wonderful thing :-))

I'm sure there are possible scenarios that it doesn't catch, but so far it's worked fine.

;david

--
David LeBer
Senior Systems Developer
PiMedia

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to deal with phone numbers (From: Jeremy Matthews <email@hidden>)

  • Prev by Date: How to deal with phone numbers
  • Next by Date: Re: How to deal with phone numbers
  • Previous by thread: How to deal with phone numbers
  • Next by thread: Re: How to deal with phone numbers
  • Index(es):
    • Date
    • Thread