I have a problem with a validator. When I'm trying to submit a form with a IntegerField 0 doesn't work,flask yelling This field is requiered
.
The form:
class Update_vars(FlaskForm):
start_date = DateField('Start date',validators = [DataRequired()])
end_date = DateField('End date',validators = [DataRequired()])
vals_allwd = IntegerField('Values allowed',validators=[DataRequired(),NumberRange(0,10)])
If you encountered this problem and know how to fix it, please let me know. Thanks. Have a great day!
EDIT: I'm thinking that 0 is read as False
for DataRequired()
.
DataRequired
validator. If you useInputRequired
instead, the problem should not arise.