Country selector widget for Yii
PHP
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
CountrySelectorWidget.php
README.md

README.md

Installation

Put the CountrySelectorWidget.php file under the extensions/ subdirectory of application base directory.

Usage

<?php

$this->widget('application.extensions.countrySelectorWidget', array(
    'value' => $model->country,
    'name' => Chtml::activeName($model, 'country'),
    'id' => Chtml::activeId($model, 'country'),
    'useCountryCode' => false,
    'defaultValue' => 'Japan',
    'firstEmpty' => false,
));

?>

Attributes

  • useCountryCode - determines whether country code (US, GB) or country full name (United States, United Kingdom) will be used for select value

  • firstEmpty - determines whether an empty option should be inserted on top of select. Text can be specified using firstText parameter.

  • firstText - specifies text for optional empty first option, by default (please select a country)

  • defaultValue - default pre-selected option for case value is empty