Reputation: 3346
I have a form with validations, like required()
or NumberRange
.
This is a search functionality, so I am using get method. The problem is that I can't use form.validate_on_submit()
with get. With post
everything work as expected, but with get
the form ignore the validations, basically never validate on submit.
What is the best way to handle this situation?
class DocSearch(Form):
client_number = IntegerField(lazy_gettext(u'Client number'), [Required()])
submit = SubmitField(lazy_gettext(u'Find'))
<form method="get" class="form" role="form">
<div class="form-group ">
{{ render_field(form.client_number) }}
</div>
<div class="form-group ">
{{ render_field(form.submit) }}
</div>
</form>
Upvotes: 0
Views: 350