Country
Availability
Overview
The fr:country component allows users to select a country or territory from the 249 official ISO 3166-1 alpha-2 countries and territories.
Key features:
Standard ISO codes: Stores the 2-letter ISO 3166-1 alpha-2 code (such as
US,CH,GB,FR,JP) in the form data.Localized names and collation: Displays country names in the active Form Runner language, sorted according to that language's dictionary collation rules (for example,
Égyptesorts underEin French andÄgyptensorts underAin German). Works both online and in offline (Scala.js) mode.Enhanced search: Uses a searchable dropdown by default on desktop and mobile, supporting:
Diacritic-insensitive matching (e.g. typing
cotematchesCôte d’Ivoire,osterreichmatchesÖsterreich).Matching by 2-letter and 3-letter ISO codes (e.g.
CH/CHE,DE/DEU,GB/GBR) and common aliases or endonyms (e.g.UK,Great Britain,USA,UAE,Holland,Suisse,Schweiz,Deutschland).Relevance ranking that prioritizes exact code/alias matches and prefix matches ahead of substring matches.
Browser autofill: Includes
autocomplete="country"by default (configurable in Form Builder's Control Settings dialog) and unencrypted ISO option values so browsers can automatically fill the country from saved address profiles.Mobile-friendly: Prevents iOS Safari auto-zoom on search input focus, disables autocorrect/spellcheck in the search box, provides touch-friendly option targets, and scrolls the control into view above the virtual keyboard when opened on touch devices.
XForms usage
You use fr:country like a regular XForms control:
Parameters and Form Builder settings
You can configure fr:country in Form Builder's Control Settings dialog, via attributes directly on <fr:country>, or via configuration properties:
preferred-countries
xs:string
""
Space- or comma-separated list of 2-letter ISO codes to pin at the top of the list in the specified order (e.g. US CA GB). Preferred countries appear once at the top above a divider line and are not duplicated in the alphabetical list below.
include-countries
xs:string
""
Space- or comma-separated list of 2-letter ISO codes. When non-empty, only the specified countries are available in the selector.
exclude-countries
xs:string
""
Space- or comma-separated list of 2-letter ISO codes to exclude from the selector.
show-code
xs:boolean
false
When true, appends the 2-letter ISO code in parentheses to each country label (e.g. Switzerland (CH)).
show-flag
xs:boolean
false
When true, prepends the country's Unicode flag emoji to each country label (e.g. 🇨🇭 Switzerland).
appearance
xs:string
search
Control appearance: search (searchable dropdown, default) or dropdown (standard <select> dropdown).
Examples
Pinning preferred countries at the top and showing flags and codes:
Restricting the list to specific countries:
Configuration properties
The default global properties are:
You can override any of these properties globally or per application/form in properties-local.xml, for example:
See also
Last updated