from flask_wtf import FlaskForm from wtforms import StringField from wtforms.validators import InputRequired, Length, Email, Optional class StartQuiz(FlaskForm): first_name = StringField('First Name(s)', validators=[InputRequired(), Length(max=30)]) surname = StringField('Surname', validators=[InputRequired(), Length(max=30)]) email = StringField('Email Address', validators=[InputRequired(), Email(message='You must enter a valid email address.'), Length(max=50)]) club = StringField('Affiliated Club (Optional)', validators=[Optional(), Length(max=50)]) test_code = StringField('Exam Code', validators=[InputRequired(), Length(min=14, max=14)]) user_code = StringField('User Code (Optional)', validators=[Optional(), Length(min=6, max=6)])