Solved

single textfield address entry

Posted on 2008-10-06
3
332 Views
Last Modified: 2013-12-17
Hi guys,
I'm trying to find a technique of providing single textbox address entry - like google / MS maps.

ie: "1205 redshire, Dallas, OH"

More specifically, how to enforce the rules client side and a process to parse the string into parameters that I can use to supply to a service.
The more detailed the better.
Using ASP.NET/C#.
Regards.
0
Comment
Question by:rotovibe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
ID: 22657039
To answer your question in the most straightforward manner possible, you would want to use a regular expression validator to validate the street address. Once validated, you could use String.Split(',') to split it along the commas which would give you the parameters.

That said, you really don't want to do this. It is much, much easier and time effective to have separate fields on your form for street, City, State, and Zip. The reason you don't see single line street address is that they are terribly difficult to validate. For example, here is a regex you can use:
http://www.sitepoint.com/forums/showthread.php?t=476591

You'll notice its a bit complex, and extremly long, and the comments show that it doesnt handle all cases. If you are satisfied with some cases and rejecting others then I suppose this would work for you.
If you are familiar with regex then you can modify it to cover more cases as you come across them, but if you are not familiar with regex then that is a semester course in itself for complex expressions.

I dont want to burst your bubble, if you like a challenge, and are willing to spend several hours perfecting a regex then go for it. The problems with street addresses are, to name a few:
-What about P.O. Boxes?
-What about street types: Street, Drive, Court, Circle, Boulevard, Parkway, Road, Way, Place, Avenue ...
-What if they abbreviate the above to: St, Dr, Ct,, Cir, Blvd, Pkwy or Pwy, Rd, Wy, Pl, Ave or Av
-BTW, this is best handled by parsing the string before validation, and converting all known street types to either an abbreviation or the full name. That part is not so hard. :)
-What if it doesnt include a street address? Very large companies, and in a few cases very small towns will do this: one you may have see is the IRS (though that probably isnt applicable to your app, you get my point) IRS, Fresno, CA XXXXX. or May Smith, Tinytown, IA, XXXXX
-Apt numbers, suite numbers
-An extra line in the address. John Smith, Accounting Dep, Big Company, 124 Madison Ave, New York, NY 20222

-But that is how it is done, there is a regex to get you started. How does google do it? They have an army of engineers and a big qa dept to test lots of combinations.
Good luck!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question