TradersVE
Because I am going to have a factory of html or widgets in Forms, addField (), it was new (ActiveField()), I think this is a bad practice, because it is an undefined dependency in the constructor, more difficult to test, than widgets separate that you can use alone or together.
<?= $form = FormBuilder::begin()
->id('form-security-login')
->action($urlGenerator->generate('site/login'))
->options(['class' => 'forms-security-login', 'csrf' => $csrf])
->validateOnType(false)
->validateOnChange(false)
->start() ?>
<?= FieldBuilder::widget()
->withForm($form)
->form($model)
->attribute('login')
->textInput([
'autofocus' => true,
'placeholder' => 'Login',
'tabindex' => '1',
])
->label('Login:') ?>
<?= FieldBuilder::widget()
->withForm($form)
->form($model)
->attribute('password')
->passwordInput([
'oninput' => 'this.setCustomValidity("")',
'oninvalid' => 'this.setCustomValidity("' . 'Enter Password Here' . '")',
'placeholder' => 'Password',
'required' => true,
'tabindex' => '2',
])
->label('Password:') ?>
<?= FieldBuilder::widget()
->withForm($form)
->form($model)
->attribute('rememberMe')
->checkbox([
'format' => 'boolean',
'options' => ['tabindex' => '3'],
]) ?>
<?= Html::submitButton(
'Login',
[
'class' => 'btn btn-block btn-lg btn-primary mt-3',
'id' => 'login-button',
'tabindex' => '4',
]
); ?>
<?= FormBuilder::end() ?>
Если это действительно форма то я логопед) лы)