RE: [OT] International telephone number formatter component????
Disclaimer: The following represents my personal experience - I'm not a phone number expert :-) As an example of the problem, the Oftel website (www.oftel.gov.uk) lists the following *recommended* formats for the UK: Fixed line phone number: * (01XX) XXX * (01XXX) XX * (01) X * (02X) 07 (mobile) number * 07XX XXX or 07XXX XX. 08 (freephone, Lo-call or National Rate) number * 08XX XXX or 08XXX XX. 09 (PRS) number * 09XX XXX or 09XXX XX. * 09XX XXX or 09XXX XX. Since you're probably only interested in fixed and cell phone numbers that cuts it down to a mere six different formats for the UK alone. At least until they change the codes again :-) I think the only thing you can guarantee about phone numbers is that if you ignore the formatting entirely and just dial the digits, you'll probably get through. Unless of course, a UK user has included the international dialling code and entered the number like + 44 (01XXX) XX. In this case, you need to dial your local international access code, then 44 for the UK, then DROP the zero, then dial the rest of the number! If you were in the UK trying to dial a US number entered as (picking a random example ;-) ) +001(805) 563-0666, you might incorrectly dial 00 001 805 563 0666 (international access code from the UK is 00). An alternative approach to attempting to validate a single telephone number field would be to split it into separate input fields e.g. - Country code : 44 - Area code: 01 - Local number : XX - Extension: (note: this 'area code' doesn't always represent a geographical area. UK cell phone numbers, for instance, are national, with the code denoting the provider.) I'd store the 'numbers' as Strings to ensure you retain whatever format your users are comfortable with (after all it is *their* number) and strip out the formatting when you need to use it. That still leaves you with the leading 0 problem (or whatever the rules are for other countries). I can only suggest that you would need to be able to look up the rules for each country and strip off any unnecessary digits based on a rule. You might be able to do this during input validation and warn the user, but to avoid confusing/infuriating the user I think I would just accept whatever they gave me and handle it intelligently when I need to use it. Telephone numbers are as personal and varied as postal codes and I just *hate* it when some site tells me my house doesn't exist because their rules can't handle my post code. Good luck! Steve > -Original Message- > From: Mick Knutson [mailto:[EMAIL PROTECTED] > Sent: October 2, 2003 7:03 AM > To: Struts Users Mailing List > Subject: Re: [OT] International telephone number formatter component > > > I do not disagree about the research part at all. I know it will take a > researcher on my staff a great deal of time to maintain, but it > is never the > less, a needed feature. > I just thought that most Countries have a fairly well formatted > number. And > mostly I am taking about supporting N.&S. America, Western Europe only. > Later look at the far East. > > But this would need to choose the whole part of the phone number then just > store the proper number into my DB for the user. Until they update the > number again, then they choose again. > > --- > Thanks > Mick Knutson > > +001(805) 563-0666 Office > +001 (708) 570-2772 Fax > --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [OT] International telephone number formatter component????
> I do not disagree about the research part at all. I know it will take a researcher on my staff a great deal of time to maintain, but it is never the less, a needed feature. I just thought that most Countries have a fairly well formatted number. And mostly I am taking about supporting N.&S. America, Western Europe only. Later look at the far East. < You may be able to accomplish what you want using localized forms and the mask rule in the validator. Assuming that your default language/country is en_US (a parochial assumption, I know), your validation.xml might contain bits like the following: mask ^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$ mask --a regexp for British phone numbers -- sorry, never been :)-- ...and so on for each language/country. Your researchers would have to provide you the masks for each country, and, as you add counties, you would add their formsets to validation.xml. A standalone validation rule might be more convenient, but this sort of approach might do the job for you. The struts-validator example webapp has a couple of sample forms that perform locale-specific validations. -Greg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] International telephone number formatter component????
I do not disagree about the research part at all. I know it will take a researcher on my staff a great deal of time to maintain, but it is never the less, a needed feature. I just thought that most Countries have a fairly well formatted number. And mostly I am taking about supporting N.&S. America, Western Europe only. Later look at the far East. But this would need to choose the whole part of the phone number then just store the proper number into my DB for the user. Until they update the number again, then they choose again. --- Thanks Mick Knutson +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- - Original Message - From: "Joe Germuska" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, October 02, 2003 6:54 AM Subject: Re: [OT] International telephone number formatter component > At 6:42 -0700 10/2/03, Mick Knutson wrote: > >I am wondering if anyone has developed an International telephone number > >formatter component? > >I have International users, creating phone numbers that will be used to > >generate emergency phone calls by a software package. So having the proper > >International number is essential. > >Just thought it might have already been done. > > It's actually a very thorny problem, as in some countries, phone > numbers don't even have a consistent number of digits, nor a common > format. So it's as much a research problem as a coding problem. I > took a stab at it a few years ago, but once I realized that the scope > of the problem outweighed my immediate needs, I left it aside. > > I'd love to hear if anyone has such a thing... > > Joe > > -- > Joe Germuska > [EMAIL PROTECTED] > http://blog.germuska.com > "We want beef in dessert if we can get it there." >-- Betty Hogan, Director of New Product Development, National > Cattlemen's Beef Association > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] International telephone number formatter component????
At 6:42 -0700 10/2/03, Mick Knutson wrote: I am wondering if anyone has developed an International telephone number formatter component? I have International users, creating phone numbers that will be used to generate emergency phone calls by a software package. So having the proper International number is essential. Just thought it might have already been done. It's actually a very thorny problem, as in some countries, phone numbers don't even have a consistent number of digits, nor a common format. So it's as much a research problem as a coding problem. I took a stab at it a few years ago, but once I realized that the scope of the problem outweighed my immediate needs, I left it aside. I'd love to hear if anyone has such a thing... Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "We want beef in dessert if we can get it there." -- Betty Hogan, Director of New Product Development, National Cattlemen's Beef Association - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]