Example #1
0
?>

<div id="create-advert">

    <!-- Advert form -->
    <?php 
$form = ActiveForm::begin(['id' => 'advert-form', 'enableClientValidation' => true, 'enableAjaxValidation' => true, 'validateOnBlur' => true, 'validationUrl' => Url::to(['validate', 'id' => $model->id]), 'fieldConfig' => ['template' => "{label}{input}"], 'clientEvents' => ['ajaxSubmitSuccess' => "function(data) {\n    \$('a[data-update], a[data-view]').magnificPopup('close');\n    return false;\n}"]]);
?>

        <div class="left">
            <?php 
echo $form->field($model, 'city_id')->dropDownList(City::getList(), ['name' => $directPopulating ? 'city_id' : null, 'label' => 'City', 'emptyItem' => Yii::t('app', 'Empty city option')]);
?>

            <?php 
echo $form->field($model, 'type', [])->dropDownList(Advert::getTypesDropDownList(), ['name' => $directPopulating ? 'type' : null, 'emptyItem' => Yii::t('app', 'Empty type option')]);
?>

            <?php 
echo $form->field($model, 'category')->dropDownList(Category::getDropdownList(), ['name' => $directPopulating ? 'category' : null, 'emptyItem' => Yii::t('app', 'Empty category option')]);
?>

            <?php 
echo $form->field($model, 'term', ['template' => '{label}{input}'])->datepicker(['name' => $directPopulating ? 'term' : null, 'datepicker' => ['dateFormat' => Yii::$app->formatter->dateFormat, 'clientOptions' => ['maxDate' => "+1m", 'minDate' => "+1d", 'monthNamesShort' => DatepickerHelper::monthNamesShort()]]]);
?>
            
            <div class="range">
                <label class="control-label" for="min_price"><?php 
echo Yii::t('app', 'Price');
?>
</label>
Example #2
0
        <div class="col-sm-9">
            <?php 
$form->field($model, 'content')->textarea([]);
?>
            <?php 
echo $form->field($model, 'content')->textarea(['name' => $directPopulating ? 'content' : null, 'rows' => 25]);
?>
        </div>
    
        <div class="col-sm-3">
            <?php 
echo $form->field($model, 'city_id')->dropDownList(City::getList(), ['name' => $directPopulating ? 'city_id' : null, 'class' => 'form-control input-sm']);
?>

            <?php 
echo $form->field($model, 'type')->dropDownList(Advert::getTypesDropDownList(), ['name' => $directPopulating ? 'type' : null, 'class' => 'form-control input-sm']);
?>

            <?php 
echo $form->field($model, 'category')->dropDownList(Category::getDropdownList(), ['name' => $directPopulating ? 'category' : null, 'class' => 'form-control input-sm']);
?>

            <?php 
/*echo $form->field($model, 'term')->datepicker([
      'name' => ($directPopulating) ? 'term' : null,
      'datepicker' => [
          'language' => 'ru',
          'dateFormat' => 'dd.MM.yyyy'
      ]
  ])*/
?>