我有活跃的表格:
<? $form = ActiveForm::begin([
'layout' => 'horizontal',
'fieldConfig' => [
'template' => "{input}\n{hint}\n{error}",
'horizontalCssClasses' => [
'error' => 'help-inline',
'hint' => '',
],
],
]);
?>
<div class="control-group">
<b>Регистрация</b>
</div>
<?
echo $form->field($model, 'login', ['options' => ['tag' => 'div', 'class' => 'control-group'],'inputOptions' => array('placeHolder' => 'Логин')]);
echo $form->field($model, 'password', ['options' => ['tag' => 'div', 'class' => 'control-group'],'inputOptions' => array('placeHolder' => 'Пароль')]);
echo $form->field($model, 'repassword', ['options' => ['tag' => 'div', 'class' => 'control-group'], 'inputOptions' => array('placeHolder' => 'Повторите пароль')]);
?>
<? ActiveForm::end(); ?>
如果用户输入了错误的数据,yii2会添加“has-error”类,但我需要“错误”类。我如何改变课程?我试图更改errorOptions的值,但它没有帮助。
答案 0 :(得分:3)
我解决了问题
{{1}}
答案 1 :(得分:0)
你可以改变这一行:
'error' => 'help-inline'
到
'error' => 'error-inline'