Flask, WTForms - Create field to accept more than one email and to have email validation

Viewed 107

I have this template for entering an email and submit it:

<tr>
                <td>{{ form.email.label(class = "form.label") }}</td>
                <td>{{ form.email(class = "form.control", id="multiEmail") }}</td>
            </tr>
            <br/>
            <tr>
                <td>
                    {{ form.submit(class = "btn-btn-secondary") }}
                    {{ form.cancel(class = "btn-btn-secondary") }}
                </td>
            </tr>

This is the class for the email form:

class UserForm(FlaskForm):
email = EmailField("Enter Email", validators=[DataRequired(), Email()])

But because there's a Email validator it cannot accept more than one email. Is there a option to tell it should be multiemail like

document.getElementById("multiEmail").multiple = true

Regards, Kamen

1 Answers

I figure it out. In case someone is wondering.

  <td>{{ form.email(class = "form.control", id="multiEmail", multiple="true") }}</td>
Related