I
I
iva-86-w12016-02-21 15:30:17
Yii
iva-86-w1, 2016-02-21 15:30:17

How to display values ​​in ActiveForm of such a table?

There is a blog_conf table, where there are value and keys fields. Unable to display values ​​via ActiveForm. I'm trying to do it like this:

<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'value')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('app', 'Update'), ['class' => 'btn btn-success']) ?>
 </div>
<?php ActiveForm::end(); ?>

public function actionIndex()
    {
    $model = new Conf();

    if ($model->load(Yii::$app->request->post()) && $model->save()) {
            return $this->redirect(['index']);
        } else {
    $model2 = Conf::find()->all();
      return $this->render('index', [
        'model' => $model2,
      ]);
    }
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iva-86-w1, 2016-02-21
@iva-86-w1

Thanks Deniska Petrov , the documentation helped https://github.com/yiisoft/yii2/blob/master/docs/g...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question