Answer the question
In order to leave comments, you need to log in
Why is an empty form displayed in Yii 2?
If the code is _form.php
<?php
use yii\widgets\ActiveForm;
?>
<div class="user-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= 1//Html::activeTextInput($model, 'email') ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord
? Yii::t('app', 'Create')
: Yii::t('app', 'Update'),
['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
Answer the question
In order to leave comments, you need to log in
I checked it myself. Connected the specified model and the used view code.
Everything works, only two errors:
1) Validator ['username', 'maxlength' => 32], invalid
should be ['username', 'string', 'max' => 32]
2) use yii\helpers\ HTML; I needed to connect.
After that it worked...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question