brutus/wtforms-html5

MonthInput does not regsiter data

Jake-Ruston opened this issue · 1 comments

I am using a MonthInput in the following way:

from flask_wtf import FlaskForm
from wtforms.fields import html5 as h5fields
from wtforms.widgets import html5 as h5widgets

class ImportForm(FlaskForm):
    month = h5fields.DateField("Month", widget=h5widgets.MonthInput(), validators=[DataRequired()])
    submit = SubmitField("Import")

However, when I submit the form with a value, the value is empty:

if form.validate_on_submit():
    pass
else:
    print(form.errors) # {'month': ['This field is required.']}

Why is this value not being passed correctly?

Sorry in advance, if I'm missing something here, but it seems to me that you are not using wtforms-html5 (and this is the issue tracker for it). This could be a problem with either flask-wtf or maybe plain wtforms though.