0

I have used Activeform for the form in yii2 and i have used email and password Input for email and passsword. But i have login for email and passwrod with remember me than email and password field on my form autocomplete by that. That code is below:

So please help to remove autocomplete using yii2. This is picture whats happen in that:

I have used following link for solutions but not proper work for me: 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>

This is picture for what happen for me: enter image description here

Please help me solve that problem.

Akash Shrimali
  • 53
  • 2
  • 12

1 Answers1

1

Modern browser will ignore Autocomplete="off" on login fields.

If a site sets autocomplete="off" for username and password fields, then the browser will still offer to remember this login, and if the user agrees, the browser will autofill those fields the next time the user visits the page.

See The autocomplete attribute and login fields

caiovisk
  • 3,190
  • 1
  • 9
  • 15