from wtforms import Form, StringField, validators class MyForm(Form): name = StringField('Name', validators=[validators.Optional()]) # In this example, the 'name' field in the form is optional.
from wtforms import Form, StringField, validators class MyForm(Form): phone_number = StringField('Phone Number', validators=[validators.Length(max=10), validators.Optional()]) # In this example, the 'phone_number' field in the form is optional, but if a value is entered, it must be 10 characters or less.Both examples use the wtforms library of Python.