[MODULE] - m-sensorario-dropdown

This module solve "country/state/city" problem. If you have similar problem like "group/user/account" or "project/task/activity" … and need a unique solution, here you have that solution =).

Be shure to have ‘urlFormat’=>‘path’ enabled in your config file







<?php $this->widget('MSensorarioDropdown.extensions.ESensorarioDropdown'); ?>


Move in your /protected/modules folder. If not exists, create it. And now clone

the repository on your project:

    $ git clone git@github.com:sensorario/MSensorarioDropdown

And add it into your module list

    'modules' => array(






To configure this module, you need to update this config file:


here the content:


    return array(

        'Country' => array(

            'id' => 'stati',

            'name' => 'Stati',

            'model' => 'Stato::getStati();',


        'State' => array(

            'id' => 'regioni',

            'name' => 'Regioni',

            'model' => 'Regione::getRegione($id);',

            'message' => 'Questa regione non ha comuni',


        'City' => array(

            'id' => 'comuni',

            'name' => 'Comuni',

            'model' => 'Comune::getComune($id);',

            'message' => 'Questa regione non ha comuni',



The widget use these vars generating this html. The most important thing to

change is model and message. Message will appear when there are no city

once selected a state. Or there are no *state once selected a country.

    <div  class="box">

        <span id="' . $this->config['Country']['id'] . '"></span>

        <span id="' . $this->config['State']['id'] . '"></span>

        <span id="' . $this->config['City']['id'] . '"></span>