Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask_WTF: PasswordField disable autocomplete

How can I add a custom parameter to a field in a flask_wtf form-field. One of my requirements is to add the autocomplete="off" to all password fields, but I can't seem to find out how I can add this parameter to a password field in flast_wtf generated form.

like image 645
Lucas Kauffman Avatar asked Feb 16 '23 20:02

Lucas Kauffman


1 Answers

You can pass HTML attributes directly to form fields by name, with the exception of class, which uses class_ to avoid the reserved word.

{{ form.password(autocomplete="off") }}

If you use a macro like this to render your fields, you can still pass it through **kwargs:

{{ render_field(form.password, autocomplete="off") }}
like image 53
robots.jpg Avatar answered Feb 19 '23 11:02

robots.jpg