Вопрос

I've created a SelectField like so:

class Inputs(Form):
    myChoices = #number of choices
    myField = SelectField(u'Field name', choices = myChoices, validators = [Required()])

The problem is that when it renders in my template:

<form action="" method="post" name="Inputs">
    {{form.hidden_tag()}}
    <p>
        {{form.myField(size=80)}}
    </p>
</form>

It looks like a long select box with all the values already shown, rather than a drop-down menu. How do I change this formatting? Thanks!

Это было полезно?

Решение

The problem was the (size=80) in my html - I deleted this and it works fine. I thought this was a way to limit the size of the dropdown similar to TextField form field, but obviously not!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top