Solved

single textfield address entry

Posted on 2008-10-06
3
331 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…

735 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