Пример #1
0
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use backend\models\Groups;
/* @var $this yii\web\View */
/* @var $model backend\models\Games */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="games-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
$groups = Groups::find()->all();
$items = ArrayHelper::map($groups, 'id', 'name');
$params = ['prompt' => 'Укажите группу'];
?>
    <?php 
echo $form->field($model, 'group_id')->dropDownList($items, $params);
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'cost')->textInput();
?>