Active Form Widget
Yii Activeform is a powerful widget which provides form inputs as well as validation. We can handle validation through the model. In this section we need to create a User Model and you can set the validation in the model.
Yii Active is based on Active Record. It uses yii\helpers\Html and yii\widgets\ActiveForm Classes.
Active form should be begin and must be end.
use yii\helpers\Html; use yii\widgets\ActiveForm; $form = ActiveForm::begin([ 'id' => 'user-form', 'options' => ['class' => 'form-control'], ]) $form->field($model, 'name')->input([//options]) $form->field($model, 'email')->input([//options]) Html::submitButton('Save', ['class' => 'btn btn-success']) ActiveForm::end();
nice post
ReplyDelete