//ActiveForm with model
<?php $form = ActiveForm::begin() ?>
<?= $form->field($model, 'username')->textInput() ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
<?php ActiveForm::end() ?>
//ActiveForm with model and custom url
<?php $form = ActiveForm::begin(['action' => ['site/login']]) ?>
<?= $form->field($model, 'username')->textInput() ?>
<?= $form->field($model, 'password')->passwordInput() ?>
<?= Html::submitButton('Login', ['class' => 'btn btn-primary', 'name' => 'login-button']) ?>
<?php ActiveForm::end() ?>
//ActiveForm without model
<?= Html::beginForm() ?>
<b>Username</b>
<?= Html::input('text', 'LoginForm[username]', null, ['class' => 'form-group form-control']) ?>
<b>Password</b>
<?= Html::input('text', 'LoginForm[password]', null, ['class' => 'form-group form-control']) ?>
<?= Html::submitButton('Login', ['class' => 'btn btn-primary form-group']) ?>
<?= Html::endForm() ?>
//ActiveForm without model and custom url
<?= Html::beginForm(['site/login'], 'post') ?>
<b>Username</b>
<?= Html::input('text', 'LoginForm[username]', null, ['class' => 'form-group form-control']) ?>
<b>Password</b>
<?= Html::input('text', 'LoginForm[password]', null, ['class' => 'form-group form-control']) ?>
<?= Html::submitButton('Login', ['class' => 'btn btn-primary form-group']) ?>
<?= Html::endForm() ?>
Comments
Post a Comment