Reputation: 97
I used this in twig :
{{ form_start(form, { 'attr': {'autocomplete': 'off'} }) }}
and this in the controller action :
'attr'=>array('autocomplete' => 'off'
But the autocomplete still not disabled!!!!
Upvotes: 6
Views: 14206
Reputation: 4313
For choiceType
field, use:
'choice_attr' => function($choice, $key, $value) {
return ['autocomplete' => 'off'];
}
Source: https://symfony.com/doc/current/reference/forms/types/choice.html#choice-attr
Upvotes: 1
Reputation: 550
UPDATE:
If you are using symfony 4 the proper way is using off
'attr'=>['autocomplete' => 'off']
Upvotes: 11