guys. I am developing a project that requires a strict location of a user ( country, state (or department or region) and city (with postal code). The idea is that I do not want to allow user input, as people (especially french people) tend to ignore autocompletes and write all uppercase with some variations (e.g. PARIS01, PARIS, PARIS 01, LYON (Nord)), so their location data is pretty messed up. On the other hand, I have to provide a complete list of cities in all coun开发者_StackOverflow社区tries to be able to force them select a city and disable manual input. Anyway, can you help me with some sources of location data ( better free or cheap) or tell me what are the advantages of expesive databases ?
Few years ago I was developing some financial application that used Zip codes and addresses heavily. I bought zip code data base issued by Polish Post (one CD). I am not sure if such thing exists for France, but I believe Postal services companies' web sites could be a good place to start.
That's normal. Uppercase for cities is common in French.
You have several alternative:
- A script linked to your form, that turn right after the input all the uppercase from a field, into lowercases.
For instance, I try to register on a site, and put my username all in uppercases, but then, a script convert my input as soon as I finished to type. I saw many scripts like this on registering pages.
In this case, the script manipulates the data before they are saved.
How to do this? Use this attribute:
> style="text-transform:uppercase"
The longer explanation is here.
- The other possibility is less good, but you can also format the data by a script
In this case, the script manipulates all the users data together, after they were saved.
- You can provide formatting help.
If people enters "PARIS01" it is because they don't know how to tell you that they live in Paris, in the first arrondissement. You have to provide clear instruction about what you expect (a lot of sites forget to do that), and to provide the number of field needed.
For instance, if someone lives in "Paris 01", it can also be written "75 001" (or 75001), so if you accept only post code, and not the name of the city, all the data will have the same format, with the same info. French post code are always 2 numbers for the department + 3 numbers for the city (including the arrondissement)
You can convert easily convert the post code to a city name using a list.
For instance, I use very often sites that ask me for my post code, and they convert automatically the post code to a city. For instance, when I type 69000, they show "Lyon".
精彩评论