Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery City Picker?

I'm looking for a city-picker like the one facebook uses on the create-an-event page. The user should be able to type the name of a city, and it will pop up with the state/province which they can select.

I think this would the easiest way to allow users to choose a city? Either that, or we'd need drill-down select boxes which first let you choose the country, then province, then the cities can be loaded... but I think that'll be too slow.

This will be used internally for our staff to quickly enter information taken over the phone. The city must be a valid one, recognized by our database. I don't know if I should force the input box into a very specific recognized format, like <city-name><comma><single-space><two-letter-province-code> which would then be parsed and looked up in the DB, or the user can pick something when the pop-up appears with city names, and then after they pick one some hidden field will be populated with the city-id. Which would give me the least headache?


I think the city-picker goes slightly beyond a typical auto-complete widget in that what's displayed in the drop-down isn't exactly the same as what gets copied into the textbox. For example, the drop-down might show the country as well, but it isn't really necessary to display this in the box. Is there a widget that supports this too?

like image 976
mpen Avatar asked Jun 04 '26 18:06

mpen


1 Answers

first of all you have to find database to work with I can recommend you this data source as far it is largest database available.

Regarding JavaScript and auto complete you can find many ready made scripts here

like image 180
Nazariy Avatar answered Jun 07 '26 23:06

Nazariy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!