views:

574

answers:

5

So it's a standard in basically every address form out there and I'm questioning why?

Address Line 2. It's in every form that asks for address details. It's never actually seemed necessary to me. It requires another field in the database and all the goofy maintenance that goes with it. Every time you use an address, you have to concatenate it and 99% of the time line 2 is empty. The other 1% of the time you could've just put it into line 1.

Instead of calling it line 2, couldn't it be called something with clearer semantics... like "apartment number"?

It ruins the semantics of the whole address concept. You don't really know what you have in either field. Except maybe that the concatenation of the two fields results in a "plain old address". But "Line 1" and "Line 2" themselves don't really have any meaning. Is something "supposed" to go in each respectively? I've never seen it. Why don't we have address line 3 while we're at it?

I've been thinking about it and realized that as a result, I don't really trust the address data in my database. The whole field is flaky in general because you can't really do validation on it (some addresses have roads and a house number, others have streets and avenues). Except these days you could do something like validate the field against a geolocation api. But simply because of the "Line 2" thing, you can't really be certain what you're doing. Should I combine the (line 1 + line 2), then validate? What do I do with the users original input if I'm correcting them ("did you mean xxx")? Do I just say, "yah, address line 2 doesn't really do anything... I just took your validated input and dumped it into line 1." Why am I even giving the end user (and myself) the chance to be confused.

The way I see it, the field should either be an address (street + house number), or if we're going to split things up, do it properly and ask for the road and house number independently.

A: 

It isn't always an apartment number. It could be a floor (single house, multiple residences), or other things.

Ignacio Vazquez-Abrams
c/o springs to mind as one of the “other things”.
Joey
Suite numbers, mail stops, company names, etc. And when you get into foreign addresses, it is common for some places to have multiple line addresses.
joseph.ferris
+1  A: 

Address line one is sometimes used by companies for an attention name, which makes address line 2 necessary for the address itself. Imagine something like:

Name: Microsoft

Address 1: Att.: Bill Gates

Address 2: One Microsoft Way

...

klausbyskov
+1  A: 

Actually, in rare cases a user might even want to have a third address line. The best solution to this is to use a <textarea> that will accept newlines for a more complex address and store the address exactly as entered in the database.

pygorex1
+1 for taking care of all cases!
Anurag
Ho\nw m\nan\ny l\nin\nes\n do\n yo\nur\n ad\ndr\nes\ns l\nab\nel\ns l\net\n yo\nu p\nri\nnt\n?
Roger Pate
Even if the field isn't a textarea a clever user can still send an HTTP POST with newlines in the address1 and address2 fields. Either way you gotta handle unexpected newlines!
pygorex1
It's not about malformed input, it's about telling the user you can accept any number of address lines (by presenting a textarea) and only finding out later, after the user is long gone and you're printing the address label, that you can't handle their (valid) input.
Roger Pate
As before, with any input type you're going to have to watch newlines. Maybe your labels can handle 21-line addresses. Maybe only three lines. Apply business logic to validate input as your needs dictate, regardless of the input field type. Don't rely on a UI element to do data validation for you.
pygorex1
A: 

I really like pygorex1's idea of just putting up a <textarea> and let the users write their addresses as they normally would without any translation to a different scheme.

If you want to validate that data, or identify parts of it separately, I think the best way is to do a Google Maps API lookup and retrieve the information you want through a standardized interface now. This is a better approach because if the user entered junk in the field, most likely you won't get any match from the Maps API.

Anurag
A: 

Allowing loose data input is never a good idea. If you must support a multi-line address, use 2 text boxes called address1 and address2. Do not use a non-structured input format (textarea) to collect structured information (an address).

Splitting up the address field into structured fields like house no, street, suite, etc... would be another solution.