The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Separate Boxes for Address?

Hi guys,

Is there any advantage over having multiple boxes for a postal address, e.g. splitting it up into single-line fields for street address, town, county, postcode, etc, or is it better practice to go for a single multi-line (textarea) field?

I'm looking at this in terms of usability best practice. What are your thoughts on this?

It depends on what you're going to do with the submitted data. If you're just going to use it for printing labels and invoices, use a single field and let the user format it as s/he likes.

If you're going to make database queries based on geographic location, you'll need to separate the values before inserting the addresses into the database. In that case, using separate fields would be easier and safer. The problem, however, especially if you're serving an international audience, is that addresses are written differently in different countries. In the UK, for instance, they tend to write them on five or six lines, while a typical Swedish address only needs two lines. But we put the number before the street name, whereas Americans and others put the number last.

So if you can keep it down to one field, do that. If not, make sure you're not putting up barriers for anyone.

I've never done anything that requires queries on specific suburbs or street addresses, and I can't imagine any system that does (tell me if you know any example) so they should go in one field. The rest - postcode, country, phone - are common for all countries. If I need to do a query based on states, then the postcode (in combination with the country) can be used.

"I disapprove of what I say,
but I will defend to the death my right to say it."