Display the field

Print

Like any other Joomla! field, the country field supports getLabel() and getInput() methods. You may call them and output their result wherever you wish in your template files. Assuming that country is the name of the field in your XML form:

Print

  1. // Display the country field previously defined
  2. echo $this->form->getLabel('my_country_field');
  3. echo $this->form->getInput('my_country_field');

Once the form is submitted, the value you get for a country field corresponds to the ISO 3166-1 alpha-2 code of the selected country. For example, if Russia is selected, you get the value RU.

See the JFormField documentation for more details about form fields in Joomla!.