【发布时间】:2019-07-05 16:16:11
【问题描述】:
我在 yii2 中使用 Activeform 作为表单,我使用电子邮件和密码输入电子邮件和密码。但是我已经登录了电子邮件和密码,记住我而不是我的表单上的电子邮件和密码字段自动完成。 该代码如下:
所以请帮助使用 yii2 删除自动完成功能。 这是图片中发生的事情:
我已使用以下链接获取解决方案,但不适用于我: Yii: disable autofill of username and password fields on chrome
<div class="col-md-12 mb-0">
<?=$form->field($model, 'coupon_code', ['inputOptions' => ['autocomplete' => 'off'],'template' => ''
. '<div class="input-group mb-3 coupon_parent_div">'
. '{input}'
. '<div class="input-group-append">'
. '<button type="button" id="coupon_btn" class="btn btn-md btn-secondary" onclick="cart_refresh();">Apply</button>'
. '</div>'
. '</div>'
. '{error}'])
->textInput(['class' => 'form-control my_input_border', 'maxlength' => true, 'placeholder' => $model->getAttributeLabel('coupon_code')])?>
</div>
<div class="form-row">
<div class="col-md-3 mb-0">
<?= $form->field($model, 'cc_cvv')->passwordInput(['class' => 'form-control my_input_border', 'maxlength' => 5, 'placeholder' => 'CVV', 'autocomplete' => 'off'])->label(false) ?>
</div>
</div>
<div class="card credit_card_custom_css">
<div class="card-body">
<div class="form-row">
<div class="col-md-7 mb-0">
<?= $form->field($model, 'cc_name',['inputOptions' => ['autocomplete' => 'off']])->textInput(['class' => 'form-control my_input_border marginBottom15', 'maxlength' => true, 'placeholder' => $model->getAttributeLabel('cc_name')])->label(false) ?>
</div>
<div class="col-md-5 mb-0">
<?= $form->field($model, 'cc_number',['inputOptions' => ['autocomplete' => 'new-password']])->textInput(['class' => 'form-control my_input_border marginBottom15', 'maxlength' => true, 'placeholder' => $model->getAttributeLabel('cc_number')])->label(false) ?>
</div>
</div>
<div class="form-row">
<div class="col-md-3 mb-0">
<?= $form->field($model, 'cc_cvv',['inputOptions' => ['autocomplete' => 'new-password']])->passwordInput(['class' => 'form-control my_input_border marginBottom15', 'maxlength' => 5, 'placeholder' => $model->getAttributeLabel('cc_cvv')])->label(false) ?>
</div>
</div>
</div>
</div>
请帮我解决这个问题。
【问题讨论】:
标签: javascript jquery css mysql yii2