[Flask] Default/Disabled choices in WTForms SelectField?

Alex Hall ahall at autodist.com
Thu May 19 14:04:13 EDT 2016


Hi all,
This is perhaps more of a WTForms question, but I'm hoping people here will
know how to do this in Flask-WTF.

I have three select lists, and until the user clicks them, they're all
blank. I want to have them each show an unselectable option to indicate
that they exist, something like
option value="1" default disabled>Please choose an option</option

I can't find a way to do this in WTF though. I found one forum that said
you can pass a "default=" argument to the SelectField constructor, but I
don't see that in the official documentation. Plus, that doesn't tell me
how to make the same item disabled, or if what goes after the equals sign
is an index or an element in the choices list of values.

Thanks for any suggestions. If this is doable, will it work the same way on
SelectMultipleField items as well?

-- 
Alex Hall
Automatic Distributors, IT department
ahall at autodist.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20160519/d826cd9e/attachment.html>


More information about the Flask mailing list