librelist archives

« back to archive

WTForm Dropdown Menu not validated

WTForm Dropdown Menu not validated

From:
Yifan Wu
Date:
2013-02-08 @ 17:13
Hi,

For some reason while using the SelectField option for WTForm (serves as a
foreign key in models) the validation is never passed. I arbitrarily set
the form validation to true and everything inserted properly. I'm not sure
what might have gone wrong (below is the html tag).

Thanks tons for the help!

-Yifan

----

        <fieldset>
            <div class="control-group{% if form.errors.panel %} error{%
endif %}">
                <label class="control-label">Select Panel:</label>
                <div class="controls">
                    {{ form.panel }}
                </div>
            </div>
        </fieldset>

Re: WTForm Dropdown Menu not validated

From:
Yifan Wu
Date:
2013-02-08 @ 17:32
Never mind! I forgot to set the coerce argument to int! Thanks!

-Yifan


On Fri, Feb 8, 2013 at 12:13 PM, Yifan Wu <yifan1030@gmail.com> wrote:

> Hi,
>
> For some reason while using the SelectField option for WTForm (serves as a
> foreign key in models) the validation is never passed. I arbitrarily set
> the form validation to true and everything inserted properly. I'm not sure
> what might have gone wrong (below is the html tag).
>
> Thanks tons for the help!
>
> -Yifan
>
> ----
>
>         <fieldset>
>             <div class="control-group{% if form.errors.panel %} error{%
> endif %}">
>                 <label class="control-label">Select Panel:</label>
>                 <div class="controls">
>                     {{ form.panel }}
>                 </div>
>             </div>
>         </fieldset>
>