[opencms-dev] SelectBoxes in OAMP Webform 1.4.1

Paul-Inge Flakstad flakstad at npolar.no
Wed May 30 15:11:09 CEST 2012

Hi again Tobias,

I just realized you can probably use the "Dynamic" field for a countries drop-down in OAMP Webforms. Have a look at the docs, I think all you need is a class that implements a particular interface. It's likely the easiest approach, and more modular too - it will be like an add-on to the module.

What I wrote was for my own forms module, not Alkacon's, so I'm using my own packages there.

I don't know if there's any best practice when extending/modifying these "standard" modules, but I've usually used the original package myself (downloaded the source, modified it to my needs and then built new replacement JARs).

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Tobias Karrer
Sent: 30. mai 2012 14:18
To: The OpenCms mailing list
Subject: Re: [opencms-dev] SelectBoxes in OAMP Webform 1.4.1

Thanks, Paul.

So you kind of "registered" your new class or just created the class CmsSelectionField in package com.alkacon.opencms.formgenerator in your own classes folder?

Thanks as well for the prepared list of countries.


Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Paul-Inge Flakstad
Gesendet: Mittwoch, 30. Mai 2012 13:28
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] SelectBoxes in OAMP Webform 1.4.1

Hi Tobias,

The easiest approach is perhaps to write your own input type class.

I just did this for another form module. Creating the class was straight-forward; just a matter of extending the select class and overriding a method or two. The difficult part was obtaining a list of countries.

Many online generators will produce a list of "countries" for you, but they will include much more than what we normally refer to as "countries". (For example: Svalbard and Bouvet Island are not commonly referred to as countries, since they're both part of Norway.)

What you probably want is a list of *sovereign states*. I found no generator for this, so I ended up with the tedious work of checking each "country" manually... I'll save you the same boredom. Here's the list I ended up with:

(Stored in workplace.properties / messages.properties, and used as a basis in my countries drop-down class)

DATA_COUNTRIES_0 = AF:Afghanistan|AL:Albania|DZ:Algeria|AD:Andorra|AO:Angola|AG:Antigua and Barbuda|AR:Argentina|AM:Armenia|AU:Australia|AT:Austria|AZ:Azerbaijan|BS:Bahamas|BH:Bahrain|BD:Bangladesh|BB:Barbados|BY:Belarus|BE:Belgium|BZ:Belize|BJ:Benin|BT:Bhutan|BO:Bolivia|BA:Bosnia and Herzegovina|BW:Botswana|BR:Brazil|BN:Brunei|BG:Bulgaria|BF:Burkina Faso|BI:Burundi|KH:Cambodia|CM:Cameroon|CA:Canada|CV:Cape Verde|CF:Central African Republic|TD:Chad|CL:Chile|CN:China|CO:Colombia|KM:Comoros|CG:Congo, Republic of the (Congo-Brazzaville)|CD:Congo, The Democratic Republic of The (Congo-Kinshasa)|CK:Cook Islands|CR:Costa Rica|CI:Cote D'ivoire|HR:Croatia|CU:Cuba|CY:Cyprus|CZ:Czech Republic|DK:Denmark|DJ:Djibouti|DM:Dominica|DO:Dominican Republic|EC:Ecuador|EG:Egypt|SV:El Salvador|GQ:Equatorial Guinea|ER:Eritrea|EE:Estonia|ET:Ethiopia|FJ:Fiji|FI:Finland|FR:France|GA:Gabon|GM:Gambia|GE:Georgia|DE:Germany|GH:Ghana|GR:Greece|GD:Grenada|GT:Guatemala|GN:Guinea|GW:Guinea-Bissau|GY:Guyana|HT:Haiti|VA:Vatican City State (Holy See)|HN:Honduras|HU:Hungary|IS:Iceland|IN:India|ID:Indonesia|IR:Iran|IQ:Iraq|IE:Ireland|IL:Israel|IT:Italy|JM:Jamaica|JP:Japan|JO:Jordan|KZ:Kazakhstan|KE:Kenya|KI:Kiribati|KP:Korea, Democratic People's Republic of (North)|KR:Korea, Republic of|XK:Kosovo|KW:Kuwait|KG:Kyrgyzstan|LA:Lao People's Democratic Republic (Laos)|LV:Latvia|LB:Lebanon|LS:Lesotho|LR:Liberia|LY:Libya|LI:Liechtenstein|LT:Lithuania|LU:Luxembourg|MK:Macedonia|MG:Madagascar|MW:Malawi|MY:Malaysia|MV:Maldives|ML:Mali|MT:Malta|MH:Marshall Islands|MR:Mauritania|MU:Mauritius|MX:Mexico|FM:Micronesia, Federated States of|MD:Moldova, Republic of|MC:Monaco|MN:Mongolia|ME:Montenegro|MA:Morocco|MZ:Mozambique|MM:Myanmar|NA:Namibia|NR:Nauru|NP:Nepal|NL:Netherlands|NZ:New Zealand|NI:Nicaragua|NE:Niger|NG:Nigeria|NU:Niue|NO:Norway|OM:Oman|PK:Pakistan|PW:Palau|PS:Palestine|PA:Panama|PG:Papua New Guinea|PY:Paraguay|PE:Peru|PH:Philippines|PL:Poland|PT:Portugal|QA:Qatar|RO:Romania|RU:Russia|RW:Rwanda|KN:Saint Kitts and Nevis|LC:Saint Lucia|VC:Saint Vincent and The Grenadines|WS:Samoa|SM:San Marino|ST:Sao Tome and Principe|SA:Saudi Arabia|SN:Senegal|RS:Serbia|SC:Seychelles|SL:Sierra Leone|SG:Singapore|SK:Slovakia|SI:Slovenia|SB:Solomon Islands|SO:Somalia|ZA:South Africa|SS:South Sudan|ES:Spain|LK:Sri Lanka|SD:Sudan|SR:Suriname|SZ:Swaziland|SE:Sweden|CH:Switzerland|SY:Syria (Syrian Arab Republic)|TW:Taiwan|TJ:Tajikistan|TZ:Tanzania|TH:Thailand|TL:Timor-leste (East Timor)|TG:Togo|TO:Tonga|TT:Trinidad and Tobago|TN:Tunisia|TR:Turkey|TM:Turkmenistan|TV:Tuvalu|UG:Uganda|UA:Ukraine|AE:United Arab Emirates|GB:United Kingdom|US:United States|UY:Uruguay|UZ:Uzbekistan|VU:Vanuatu|VE:Venezuela|VN:Vietnam|YE:Yemen|ZM:Zambia|ZW:Zimbabwe

Best regards,

From: opencms-dev-bounces at opencms.org<mailto:opencms-dev-bounces at opencms.org> [mailto:opencms-dev-bounces at opencms.org]<mailto:[mailto:opencms-dev-bounces at opencms.org]> On Behalf Of Tobias Karrer
Sent: 30. mai 2012 13:00
To: The OpenCms mailing list
Subject: [opencms-dev] SelectBoxes in OAMP Webform 1.4.1


I'd like to fill selectbox-options with a country list, without entering all countries in the field "Default value".
Is there an easy possibility, or do I have to patch the class CmsSelectionField?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120530/b11b42b6/attachment.htm>

More information about the opencms-dev mailing list