Managing long lists with Listo

Imagine that you need to make a contact form that has fields for the sender’s location and you want them to choose their country from a list. There are about 200 countries in the world — you’ll soon realize that the list becomes terribly long.

Previously, the only way to generate such a long list with Contact Form 7 was to manually add all the options into a form-tag as shown below.

[select your-country “Aruba” “Afghanistan” “Angola” “Albania” “Andorra” “United Arab Emirates” “Argentina” “Armenia” “American Samoa” “Antigua and Barbuda” “Australia” “Austria” “Azerbaijan” “Burundi” “Belgium” “Benin” “Burkina Faso” “Bangladesh” “Bulgaria” “Bahrain” “Bahamas” “Bosnia and Herzegovina” “Belarus” “Belize” “Bermuda” “Bolivia, Plurinational State of” “Brazil” “Barbados” “Brunei Darussalam” “Bhutan” “Botswana” “Central African Republic” “Canada” “Switzerland” “Chile” “China” “Côte d’Ivoire” “Cameroon” “Congo, the Democratic Republic of the” “Congo” “Cook Islands” “Colombia” “Comoros” “Cape Verde” “Costa Rica” “Cuba” “Cayman Islands” “Cyprus” “Czech Republic” “Germany” “Djibouti” “Dominica” “Denmark” “Dominican Republic” “Algeria” “Ecuador” “Egypt” “Eritrea” “Spain” “Estonia” “Ethiopia” “Finland” “Fiji” “France” “Micronesia, Federated States of” “Gabon” “United Kingdom” “Georgia” “Ghana” “Guinea” “Gambia” “Guinea-Bissau” “Equatorial Guinea” “Greece” “Grenada” “Guatemala” “Guam” “Guyana” “Hong Kong” “Honduras” “Croatia” “Haiti” “Hungary” “Indonesia” “India” “Ireland” “Iran, Islamic Republic of” “Iraq” “Iceland” “Israel” “Italy” “Jamaica” “Jordan” “Japan” “Kazakhstan” “Kenya” “Kyrgyzstan” “Cambodia” “Kiribati” “Saint Kitts and Nevis” “Korea, Republic of” “Kuwait” “Lao People’s Democratic Republic” “Lebanon” “Liberia” “Libya” “Saint Lucia” “Liechtenstein” “Sri Lanka” “Lesotho” “Lithuania” “Luxembourg” “Latvia” “Morocco” “Monaco” “Moldova, Republic of” “Madagascar” “Maldives” “Mexico” “Marshall Islands” “Macedonia, the former Yugoslav Republic of” “Mali” “Malta” “Myanmar” “Montenegro” “Mongolia” “Mozambique” “Mauritania” “Mauritius” “Malawi” “Malaysia” “Namibia” “Niger” “Nigeria” “Nicaragua” “Netherlands” “Norway” “Nepal” “Nauru” “New Zealand” “Oman” “Pakistan” “Panama” “Peru” “Philippines” “Palau” “Papua New Guinea” “Poland” “Puerto Rico” “Korea, Democratic People’s Republic of” “Portugal” “Paraguay” “Palestine, State of” “Qatar” “Romania” “Russian Federation” “Rwanda” “Saudi Arabia” “Sudan” “Senegal” “Singapore” “Solomon Islands” “Sierra Leone” “El Salvador” “San Marino” “Somalia” “Serbia” “Sao Tome and Principe” “Suriname” “Slovakia” “Slovenia” “Sweden” “Swaziland” “Seychelles” “Syrian Arab Republic” “Chad” “Togo” “Thailand” “Tajikistan” “Turkmenistan” “Timor-Leste” “Tonga” “Trinidad and Tobago” “Tunisia” “Turkey” “Tuvalu” “Taiwan, Province of China” “Tanzania, United Republic of” “Uganda” “Ukraine” “Uruguay” “United States” “Uzbekistan” “Saint Vincent and the Grenadines” “Venezuela, Bolivarian Republic of” “Virgin Islands, U.S.” “Viet Nam” “Vanuatu” “Samoa” “Yemen” “South Africa” “Zambia” “Zimbabwe”]

Managing 200 or more options is almost impossible, and parsing this form-tag would consume memory and time on your server computer. The situation of a list of countries in a contact form is not that rare; it should be easier to set up. That’s why I created Listo, another WordPress plugin.

Listo is a simple plugin that provides several kinds of common lists for other plugins like Contact Form 7. Listo currently provides lists of world countries, U.S. subdivisions, and world currencies (shown at the bottom of this page), with more to come.

Contact Form 7 supports cooperation with Listo and allows drop-down menus, checkboxes, and radio buttons, with a long list of options that Listo provides. You don’t need painful manual editing anymore.

How to manage long lists in a contact form

Let’s try creating a drop-down menu for selecting a country. We get the option values from Listo, so activate Listo if it’s not active yet.

Let’s start by creating a form-tag for a typical drop-down menu. We use [select] form-tag.

[select your-country]

This tag doesn’t have values yet, so it will be displayed as an empty menu. Next, we add the countries list as its option values. To add values provided by Listo, add a ‘data’ option to a form-tag, like this.

[select your-country data:countries]

Just adding data:countries gives the menu about 200 country options. Simple, right?

Looking through the menu items, you may find something unexpected; for example, “Antarctica” is in the countries list. Is Antarctica a country where people live? The reason Antarctica is in the list is that the data source of the countries list is the ISO 3166 standard, which includes some non-country special areas.

Thus, the definition of a country can differ according to standards. For dealing with different definitions, Listo also provides a grouping function. For the world countries list, Listo provides two subgroups: “un” and “olympic”. The “un” subgroup only includes members of the United Nations, while the “olympic” subgroup only includes participating nations at the 2012 London Summer Olympic Games. A complete list with subgroups is shown at the bottom of this page.

To specify the data option with subgroup, append a period (.) and the name of subgroup to the option.

[select your-country data:countries.olympic]

This menu will only include participating Olympic nations in its options; you won’t see Antarctica there.

The complete lists Listo provides

Countries [countries]

A list of countries and dependent territories based on the ISO 3166 standard.

Usage example:

[select your-country data:countries.olympic]
NameIn Group
1Arubaolympic
2Afghanistanun, olympic
3Angolaun, olympic
4Anguilla
5Åland Islands
6Albaniaun, olympic
7Andorraun, olympic
8United Arab Emiratesun, olympic
9Argentinaun, olympic
10Armeniaun, olympic
11American Samoaolympic
12Antarctica
13French Southern Territories
14Antigua and Barbudaun, olympic
15Australiaun, olympic
16Austriaun, olympic
17Azerbaijanun, olympic
18Burundiun, olympic
19Belgiumun, olympic
20Beninun, olympic
21Bonaire, Sint Eustatius and Saba
22Burkina Fasoun, olympic
23Bangladeshun, olympic
24Bulgariaun, olympic
25Bahrainun, olympic
26Bahamasun, olympic
27Bosnia and Herzegovinaun, olympic
28Saint Barthélemy
29Belarusun, olympic
30Belizeun, olympic
31Bermudaolympic
32Bolivia, Plurinational State ofun, olympic
33Brazilun, olympic
34Barbadosun, olympic
35Brunei Darussalamun, olympic
36Bhutanun, olympic
37Bouvet Island
38Botswanaun, olympic
39Central African Republicun, olympic
40Canadaun, olympic
41Cocos (Keeling) Islands
42Switzerlandun, olympic
43Chileun, olympic
44Chinaun, olympic
45Côte d'Ivoireun, olympic
46Cameroonun, olympic
47Congo, Democratic Republic of theun, olympic
48Congoun, olympic
49Cook Islandsolympic
50Colombiaun, olympic
51Comorosun, olympic
52Cabo Verdeun, olympic
53Costa Ricaun, olympic
54Cubaun, olympic
55Curaçao
56Christmas Island
57Cayman Islandsolympic
58Cyprusun, olympic
59Czechiaun, olympic
60Germanyun, olympic
61Djiboutiun, olympic
62Dominicaun, olympic
63Denmarkun, olympic
64Dominican Republicun, olympic
65Algeriaun, olympic
66Ecuadorun, olympic
67Egyptun, olympic
68Eritreaun, olympic
69Western Sahara
70Spainun, olympic
71Estoniaun, olympic
72Ethiopiaun, olympic
73Finlandun, olympic
74Fijiun, olympic
75Falkland Islands (Malvinas)
76Franceun, olympic
77Faroe Islands
78Micronesia, Federated States ofun, olympic
79Gabonun, olympic
80United Kingdom of Great Britain and Northern Irelandun, olympic
81Georgiaun, olympic
82Guernsey
83Ghanaun, olympic
84Gibraltar
85Guineaun, olympic
86Guadeloupe
87Gambiaun, olympic
88Guinea-Bissauun, olympic
89Equatorial Guineaun, olympic
90Greeceun, olympic
91Grenadaun, olympic
92Greenland
93Guatemalaun, olympic
94French Guiana
95Guamolympic
96Guyanaun, olympic
97Hong Kongolympic
98Heard Island and McDonald Islands
99Hondurasun, olympic
100Croatiaun, olympic
101Haitiun, olympic
102Hungaryun, olympic
103Indonesiaun, olympic
104Isle of Man
105Indiaun, olympic
106British Indian Ocean Territory
107Irelandun, olympic
108Iran, Islamic Republic ofun, olympic
109Iraqun, olympic
110Icelandun, olympic
111Israelun, olympic
112Italyun, olympic
113Jamaicaun, olympic
114Jersey
115Jordanun, olympic
116Japanun, olympic
117Kazakhstanun, olympic
118Kenyaun, olympic
119Kyrgyzstanun, olympic
120Cambodiaun, olympic
121Kiribatiun, olympic
122Saint Kitts and Nevisun, olympic
123Korea, Republic ofun, olympic
124Kuwaitun, olympic
125Lao People's Democratic Republicun, olympic
126Lebanonun, olympic
127Liberiaun, olympic
128Libyaun, olympic
129Saint Luciaun, olympic
130Liechtensteinun, olympic
131Sri Lankaun, olympic
132Lesothoun, olympic
133Lithuaniaun, olympic
134Luxembourgun, olympic
135Latviaun, olympic
136Macao
137Saint Martin (French part)
138Moroccoun, olympic
139Monacoun, olympic
140Moldova, Republic ofun, olympic
141Madagascarun, olympic
142Maldivesun, olympic
143Mexicoun, olympic
144Marshall Islandsun, olympic
145North Macedoniaun, olympic
146Maliun, olympic
147Maltaun, olympic
148Myanmarun, olympic
149Montenegroun, olympic
150Mongoliaun, olympic
151Northern Mariana Islands
152Mozambiqueun, olympic
153Mauritaniaun, olympic
154Montserrat
155Martinique
156Mauritiusun, olympic
157Malawiun, olympic
158Malaysiaun, olympic
159Mayotte
160Namibiaun, olympic
161New Caledonia
162Nigerun, olympic
163Norfolk Island
164Nigeriaun, olympic
165Nicaraguaun, olympic
166Niue
167Netherlands, Kingdom of theun, olympic
168Norwayun, olympic
169Nepalun, olympic
170Nauruun, olympic
171New Zealandun, olympic
172Omanun, olympic
173Pakistanun, olympic
174Panamaun, olympic
175Pitcairn
176Peruun, olympic
177Philippinesun, olympic
178Palauun, olympic
179Papua New Guineaun, olympic
180Polandun, olympic
181Puerto Ricoolympic
182Korea, Democratic People's Republic ofun, olympic
183Portugalun, olympic
184Paraguayun, olympic
185Palestine, State ofolympic
186French Polynesia
187Qatarun, olympic
188Réunion
189Romaniaun, olympic
190Russian Federationun, olympic
191Rwandaun, olympic
192Saudi Arabiaun, olympic
193Sudanun, olympic
194Senegalun, olympic
195Singaporeun, olympic
196South Georgia and the South Sandwich Islands
197Saint Helena, Ascension and Tristan da Cunha
198Svalbard and Jan Mayen
199Solomon Islandsun, olympic
200Sierra Leoneun, olympic
201El Salvadorun, olympic
202San Marinoun, olympic
203Somaliaun, olympic
204Saint Pierre and Miquelon
205Serbiaun, olympic
206South Sudanun, olympic
207Sao Tome and Principeun, olympic
208Surinameun, olympic
209Slovakiaun, olympic
210Sloveniaun, olympic
211Swedenun, olympic
212Eswatiniun, olympic
213Sint Maarten (Dutch part)
214Seychellesun, olympic
215Syrian Arab Republicun, olympic
216Turks and Caicos Islands
217Chadun, olympic
218Togoun, olympic
219Thailandun, olympic
220Tajikistanun, olympic
221Tokelau
222Turkmenistanun, olympic
223Timor-Lesteun, olympic
224Tongaun, olympic
225Trinidad and Tobagoun, olympic
226Tunisiaun, olympic
227Türkiyeun, olympic
228Tuvaluun, olympic
229Taiwan, Province of Chinaolympic
230Tanzania, United Republic ofun, olympic
231Ugandaun, olympic
232Ukraineun, olympic
233United States Minor Outlying Islands
234Uruguayun, olympic
235United States of Americaun, olympic
236Uzbekistanun, olympic
237Holy See
238Saint Vincent and the Grenadinesun, olympic
239Venezuela, Bolivarian Republic ofun, olympic
240Virgin Islands, Britisholympic
241Virgin Islands, U.S.olympic
242Viet Namun, olympic
243Vanuatuun, olympic
244Wallis and Futuna
245Samoaun, olympic
246Yemenun, olympic
247South Africaun, olympic
248Zambiaun, olympic
249Zimbabweun, olympic
U.S. subdivisions [us_subdivisions]

The list of subdivisions of the United States based on the ISO 3166-2:US standard.

Usage example:

[select your-state data:us_subdivisions.states data:us_subdivisions.districts]
NameIn Group
1Alaskastates
2Alabamastates
3Arkansasstates
4American Samoaoutlying_areas
5Arizonastates
6Californiastates
7Coloradostates
8Connecticutstates
9District of Columbiadistricts
10Delawarestates
11Floridastates
12Georgiastates
13Guamoutlying_areas
14Hawaiistates
15Iowastates
16Idahostates
17Illinoisstates
18Indianastates
19Kansasstates
20Kentuckystates
21Louisianastates
22Massachusettsstates
23Marylandstates
24Mainestates
25Michiganstates
26Minnesotastates
27Missouristates
28Northern Mariana Islandsoutlying_areas
29Mississippistates
30Montanastates
31North Carolinastates
32North Dakotastates
33Nebraskastates
34New Hampshirestates
35New Jerseystates
36New Mexicostates
37Nevadastates
38New Yorkstates
39Ohiostates
40Oklahomastates
41Oregonstates
42Pennsylvaniastates
43Puerto Ricooutlying_areas
44Rhode Islandstates
45South Carolinastates
46South Dakotastates
47Tennesseestates
48Texasstates
49United States Minor Outlying Islandsoutlying_areas
50Utahstates
51Virginiastates
52Virgin Islands, U.S.outlying_areas
53Vermontstates
54Washingtonstates
55Wisconsinstates
56West Virginiastates
57Wyomingstates
Currencies [currencies]

A list of currencies based on the ISO 4217 standard.

Usage example:

[select your-currency data:currencies]
NameIn Group
1United Arab Emirates dirham
2Afghan afghani
3Albanian lek
4Armenian dram
5Netherlands Antillean guilder
6Angolan kwanza
7Argentine peso
8Australian dollar
9Aruban florin
10Azerbaijani manat
11Bosnia and Herzegovina convertible mark
12Barbados dollar
13Bangladeshi taka
14Bulgarian lev
15Bahraini dinar
16Burundian franc
17Bermudian dollar
18Brunei dollar
19Boliviano
20Brazilian real
21Bahamian dollar
22Bhutanese ngultrum
23Botswana pula
24Belarusian ruble
25Belize dollar
26Canadian dollar
27Congolese franc
28Swiss franc
29Chilean peso
30Chinese yuan
31Colombian peso
32Costa Rican colon
33Cuban peso
34Cape Verde escudo
35Czech koruna
36Djiboutian franc
37Danish krone
38Dominican peso
39Algerian dinar
40Egyptian pound
41Eritrean nakfa
42Ethiopian birr
43Euro
44Fiji dollar
45Falkland Islands pound
46Pound sterling
47Georgian lari
48Ghanaian cedi
49Gibraltar pound
50Gambian dalasi
51Guinean franc
52Guatemalan quetzal
53Guyanese dollar
54Hong Kong dollar
55Honduran lempira
56Croatian kuna
57Haitian gourde
58Hungarian forint
59Indonesian rupiah
60Israeli new shekel
61Indian rupee
62Iraqi dinar
63Iranian rial
64Icelandic króna
65Jamaican dollar
66Jordanian dinar
67Japanese yen
68Kenyan shilling
69Kyrgyzstani som
70Cambodian riel
71Comoro franc
72North Korean won
73South Korean won
74Kuwaiti dinar
75Cayman Islands dollar
76Kazakhstani tenge
77Lao kip
78Lebanese pound
79Sri Lankan rupee
80Liberian dollar
81Lesotho loti
82Lithuanian litas
83Libyan dinar
84Moroccan dirham
85Moldovan leu
86Malagasy ariary
87Macedonian denar
88Myanma kyat
89Mongolian tugrik
90Macanese pataca
91Mauritanian ouguiya
92Mauritian rupee
93Maldivian rufiyaa
94Malawian kwacha
95Mexican peso
96Malaysian ringgit
97Mozambican metical
98Namibian dollar
99Nigerian naira
100Nicaraguan córdoba
101Norwegian krone
102Nepalese rupee
103New Zealand dollar
104Omani rial
105Panamanian balboa
106Peruvian nuevo sol
107Papua New Guinean kina
108Philippine peso
109Pakistani rupee
110Polish złoty
111Paraguayan guaraní
112Qatari riyal
113Romanian new leu
114Serbian dinar
115Russian ruble
116Rwandan franc
117Saudi riyal
118Solomon Islands dollar
119Seychelles rupee
120Sudanese pound
121Swedish krona/kronor
122Singapore dollar
123Saint Helena pound
124Sierra Leonean leone
125Somali shilling
126Surinamese dollar
127South Sudanese pound
128São Tomé and Príncipe dobra
129Syrian pound
130Swazi lilangeni
131Thai baht
132Tajikistani somoni
133Turkmenistani manat
134Tunisian dinar
135Tongan paʻanga
136Turkish lira
137Trinidad and Tobago dollar
138New Taiwan dollar
139Tanzanian shilling
140Ukrainian hryvnia
141Ugandan shilling
142United States dollar
143Uruguayan peso
144Uzbekistan som
145Venezuelan bolívar
146Vietnamese dong
147Vanuatu vatu
148Samoan tala
149CFA franc BEAC
150East Caribbean dollar
151CFA franc BCEAO
152CFP franc (franc Pacifique)
153Yemeni rial
154South African rand
155Zambian kwacha
156Zimbabwe dollar

Just another contact form plugin for WordPress. Simple but flexible.