[opencms-dev] SelectBoxes in OAMP Webform 1.4.1

Tobias Karrer tobias.karrer at virtual-identity.com
Wed May 30 14:18:09 CEST 2012


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.

 

Best,

Tobias

 

 

 

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:B
elize|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:Kaza
khstan|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:Liechtenst
ein|LT:Lithuania|LU:Luxembourg|MK:Macedonia|MG:Madagascar|MW:Malawi|MY:M
alaysia|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:Myanm
ar|NA:Namibia|NR:Nauru|NP:Nepal|NL:Netherlands|NZ:New
Zealand|NI:Nicaragua|NE:Niger|NG:Nigeria|NU:Niue|NO:Norway|OM:Oman|PK:Pa
kistan|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:Syri
a (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:Ukrai
ne|AE:United Arab Emirates|GB:United Kingdom|US:United
States|UY:Uruguay|UZ:Uzbekistan|VU:Vanuatu|VE:Venezuela|VN:Vietnam|YE:Ye
men|ZM:Zambia|ZW:Zimbabwe

 

Best regards,

Paul

 

From: opencms-dev-bounces at opencms.org
[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

 

Hi,

 

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?

 

Best,

Tobias

 

 

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


More information about the opencms-dev mailing list