I have a problem with WTForms validators.optional () because it stops the validation chain if the field is empty ( WTForms docs ). This means that validation is not performed using custom functions, which can lead to type errors.
Code example:
class MyForm(form): myfield = TextField('My Field', [validators.Optional()]) def validate_myfield(form, field): field.data = unicode(field.data)
Is there a way or workaround to continue the validation chain, even if the optional content is empty, perhaps using custom validators ?
If I approach the problem incorrectly, a hint in the right direction will be helpful!
source share