Custom validators don't seem to fire. I've followed the documentation on the wiki as well as tried various online solutions
from wtforms import Form, StringField
from wtforms.validators import ValidationError
class xyzForm(Form):
name = StringField("name")
def validate_name(form, field): # Using (self, field) or (self, form, field) also doesn't work
print('fired')
if len(field.data) > 2:
raise ValidationError('blahblah')
Similarly, the following also doesn't work
from wtforms import Form, StringField
from wtforms.validators import ValidationError
def custom_val(form, field):
print('fired')
if len(field.data) > 2:
raise ValidationError('blahblah')
class xyzForm(Form):
name = StringField("name", validators=[custom_val])
Custom validators don't seem to fire. I've followed the documentation on the wiki as well as tried various online solutions
Similarly, the following also doesn't work
Environment