<div dir="ltr">Hey Alex,<div><br></div><div>So the you can pass the default  via the keyword argument `default`. In something like a SelectField, you just give it the same value as the default choice (i.e. if you have a choice that's `(1,"My First Choice")`, default would be `default=1`). </div><div><br></div><div>Now for disabled, you have to slightly abuse HTML. From what I remember, as long as "disabled" is present within the tag, most browsers will read that as disabled. Its supposed to be a boolean field, and supposedly setting it to a null string or "false" should enable the field, but that's never worked for me. You can assign "disabled" a value, which should cause it to evaluate as true for all browsers. Something as simple as disabled="disabled in your input field should be enough to cause the browser to render it as disabled.</div><div><br></div><div>So WTForms will accept keyword arguments to render to the field when generating the html. So in your template, you can feed it `disabled="disabled"` when you print your field (i.e. myform.selfield(disabled="disabled")). Or if you want all instances of this form to have that field disabled by default, and your JS will enable it later, you can use the `render_kw` argument in the SelectField when you declare your form.</div><div><br></div><div>All of this is listed in the WTForms docs (<a href="http://wtforms.readthedocs.io/en/latest/fields.html#the-field-base-class">http://wtforms.readthedocs.io/en/latest/fields.html#the-field-base-class</a>). It's part of the Field base class. Hope this helps!</div><div><br></div><div>I put together a Gist with an example: <a href="https://gist.github.com/ajford/564cd00b361a08630b626d24408206b4">https://gist.github.com/ajford/564cd00b361a08630b626d24408206b4</a></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Anthony Ford,<br>KF5IBN,<div><a href="mailto:ford.anthonyj@gmail.com" target="_blank">ford.anthonyj@gmail.com</a></div></div></div></div>
<br><div class="gmail_quote">On Thu, May 19, 2016 at 1:04 PM, Alex Hall <span dir="ltr"><<a href="mailto:ahall@autodist.com" target="_blank">ahall@autodist.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi all,<br></div>This is perhaps more of a WTForms question, but I'm hoping people here will know how to do this in Flask-WTF.<br><br></div>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<br></div>option value="1" default disabled>Please choose an option</option<br><br></div>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.<br><br></div>Thanks for any suggestions. If this is doable, will it work the same way on SelectMultipleField items as well?<span class="HOEnZb"><font color="#888888"><br clear="all"><div><div><div><div><div><div><div><br>-- <br><div><div dir="ltr"><div><div>Alex Hall<br></div>Automatic Distributors, IT department<br></div><a href="mailto:ahall@autodist.com" target="_blank">ahall@autodist.com</a><br></div></div>
</div></div></div></div></div></div></div></font></span></div>
<br>_______________________________________________<br>
Flask mailing list<br>
<a href="mailto:Flask@python.org">Flask@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/flask" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/flask</a><br>
<br></blockquote></div><br></div>