Ejemplo n.º 1
7
 public function run()
 {
     $out = '';
     $countryDropdown = Select2::widget(['name' => 'country', 'value' => '', 'data' => Country::dropdown(), 'options' => ['label' => 'yaya', 'placeholder' => 'Select Country ...', 'id' => 'country-selection']]);
     $locationDropdown = $this->form->field($this->model, 'location_id')->label(false)->widget(DepDrop::classname(), ['type' => DepDrop::TYPE_SELECT2, 'options' => ['id' => 'location-selection'], 'select2Options' => ['pluginOptions' => ['allowClear' => TRUE]], 'pluginOptions' => ['depends' => ['country-selection'], 'placeholder' => 'Select Location', 'url' => Url::to(['/location/admin/load'])]]);
     $this->_printField($countryDropdown, $out);
     $this->_printField($locationDropdown, $out);
     return $out;
 }
Ejemplo n.º 2
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use humanized\location\models\location\Country;
/* @var $this yii\web\View */
/* @var $model humanized\contact\models\location\CitySearch */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="city-search">

    <?php 
$form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']);
?>
    <div class="row">
        <div class="col-sm-3">
            <?php 
echo $form->field($model, 'country_id')->label(false)->dropDownList(Country::dropdown(), ['onChange' => 'this.form.submit()']);
?>
        </div>

    </div>
    <?php 
ActiveForm::end();
?>

</div>