Re: Dynamically adding fields to a Flask-wtf form.

2019-02-24 Thread Seb-astian
I think your previous way would be possible by using

myField = SelectField('myselect',[]) 

to create an empty List of options which you might fill afterwards. Note 
that it would be a good idea to insert some fallback value, as if the later 
assignment fails, the page would fail to load with an empty list given.

Am Mittwoch, 5. April 2017 15:24:05 UTC+2 schrieb Tom Wright:
>
> Ok, the problem was how I was building the SelectField
>
> myField = SelectField('myselect')
> myField.choices = [(1, 'a'), (2,'b')]
>
> Doesn't work!!!
>
> myField = SelectField('myselect', choices = [(1, 'a'), (2, 'b')])
>
> Does :-)
>

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pocoo-libs+unsubscr...@googlegroups.com.
To post to this group, send email to pocoo-libs@googlegroups.com.
Visit this group at https://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamically adding fields to a Flask-wtf form.

2017-04-05 Thread Tom Wright
Ok, the problem was how I was building the SelectField

myField = SelectField('myselect')
myField.choices = [(1, 'a'), (2,'b')]

Doesn't work!!!

myField = SelectField('myselect', choices = [(1, 'a'), (2, 'b')])

Does :-)

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pocoo-libs+unsubscr...@googlegroups.com.
To post to this group, send email to pocoo-libs@googlegroups.com.
Visit this group at https://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/d/optout.