user2794692
user2794692

Reputation: 391

How to avoid autocomplete form with Chrome in Symfony2

I have a form made with Symfony2:

->add('password', 'repeated', array('data' => '', 'label' => 'Repeat New Password', 'type' => 'password', 'required' => false,
        'first_options' => array('data' => '', 'label' => 'New password', 'always_empty' => true),
        'second_options' => array('label' => 'Repeat new password'),

But in Chrome, the browser try to autocomplete the field New password.

How can I avoid this?

Thanks.

Upvotes: 0

Views: 5102

Answers (1)

Ramesh
Ramesh

Reputation: 4293

Try this:

->add('password', 'repeated', array('data' => '', 'label' => 'Repeat New Password',  'type' => 'password', 'required' => false,
    'first_options' => array('attr' => array("autocomplete" => "off")),
    'second_options' => array('attr' => array("autocomplete" => "off")),

Upvotes: 6

Related Questions