Geodata Solutions

  • Generator
  • Blog
  • Contribute
  • Contact
  • Report an error

Dropdowns with snippets

Subcategories

Adding the script to your site

Adding Geodata dropdowns to your site is designed to be easy. For most users, they'll simply copy and paste the code for the Dropdown set they want into their site, and that's it.

For those with more specific needs, or are looking for higher security option, then you can choose to use the REST API to retrieve the data. You can use GET or POST, and send it over https for security. No subscription or authentication is needed.

Formatting the lists

The formatting of the lists is pretty basic in the default code samples provided. This will suit most people's needs. but others may require more control over the pre-selection of options, ordering of locations or various other formatting of the lists. In most cases, this is done by simply adding class names to the fields. We couldn't think of an easier way.

The best way to get the code and field classes you need, is to use the dropdown wizard to create your code snippet on-the-fly.

Grouping and ordering

You might like to group the items in your country dropdown by continent. You might like to have cities ordered by their relative populations. All you need to do is add class names to your dropdown lists and our system will present your lists just as you require.

Setting defaults

You may like to have certain options pre-selected to save people time. This makes sense if you know the country where most of your visitors live. You may even choose to use a visitor's IP address to predict from where they're viewing your site, and pre-select the country accordingly. These little touches make the lists a bit easier to use, and makes them a little more personal.

Limiting and filtering

There are lots of times where you might like to cut down on the options available. If you sell products internationally, but have a few countries that are 'off-limits', then you can exclude them from the countries presented. Similarly, if the list of cities being presented is too long, you can choose to limit results to cities over the certain population, 5000 for example.

Using the data

What's the point of having clever dropdown lists if you can't store the data your users are selecting. The whole point of lists in forms is that you can store the relevant data somewhere in order to use it. Storing the IDs that correspond to a city or the State Code that corresponds to a state isn't really going to be useful unless you have the database to correlate IDs again, and this is what Geodata Solutions helps you avoid. 

The value of the field you choose is the full text version of the location name. The field name 'country' , 'state' , and 'city' are as generic and re-usable as possible. You're very welcome!

Dynamic fields

When a user selects an option, you can easily create new fields that appear in your form on-the-fly, displaying the data you need for your system. These hidden new field can be used to populate your database with the names of the locations your users are selecting.

In development: This feature isn't on the live version just yet. If you have an urgent requirement, please get in touch and we'll make it a priority.

The 'Other' option

There's going to be times when the name of the city someone needs to select isn't in our list. This is tricky if you need a shipping address and your users are left with no way of entering their 'off-the-map' locality. You can specify an 'Other' selection option appears at the bottom of the list. Selecting this option will render a new text field where users can type in the name of the place where they live. And, as with most of our other functionality, it can be achieved by adding a few class names.

In development: This feature isn't on the live version just yet. If you have an urgent requirement, please get in touch and we'll make it a priority.

Login Form

  • Forgot your username?
  • Forgot your password?

Resources

  • Dropdown docs
  • REST Docs
  • REST Demo
  • REST Dropdowns
  • Joomla Plugin

Background

  • What we do
  • Web Service Vs Copied Data
  • Why pay for public data?

Geodata Solutions is brought to you by Netamity © 2020