<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>hey ben,</p>
<p>in your example, just add a value="{{ form.email.data }}" to your
<input />.</p>
<p>i am sure there is an example somewhere in either flask snippets
or flask-wtform examples.<br>
</p>
<p>hope that helps,</p>
<p>ub<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 9/18/19 3:02 PM, Ben Duncan wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAC10dPYrvjrU_1tPCQbKVp-X8vFDu2H4AWH8QfAdVFzQA1zvsg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>In Flask / Wtforms, if you fail the validation, how to <br>
</div>
<div>show the values back on the web form ?</div>
<div>Sample:</div>
<div><br>
</div>
<div> <div>{{ form.email.label.text }}</div><br>
<input <br>
</div>
<div> style='width: 350px;' <br>
</div>
<div> name='email' <br>
</div>
<div> id='email' <br>
</div>
<div> type='text' <br>
</div>
<div> size='30'<br>
><br>
{% if form.email.errors %}<br>
<ul class="errors"><br>
{% for error in form.email.errors %}<br>
<li>{{ error }}</li><br>
{% endfor %}<br>
</ul><br>
{% endif %}</div>
<div><br>
</div>
<div>with the class being defined:</div>
<div>class ContactForm(FlaskForm):<br>
name = StringField("Name: ",
validators=[DataRequired()])<br>
email = StringField("Email: ", validators=[Email()])</div>
<div><br>
</div>
<div>If there was an error of any sort, I would like the form
errors to be re-displayed...</div>
<div><br>
</div>
<div>Thanks<br>
</div>
<div><br>
</div>
<div>
<div dir="ltr" class="m_-1099232091542945159gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div><b>Ben Duncan</b></div>
<div>DBA / Chief Software Architect <br>
</div>
<div>Mississippi State Supreme Court</div>
<div>Electronic Filing Division<br>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Flask mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Flask@python.org">Flask@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/flask">https://mail.python.org/mailman/listinfo/flask</a>
</pre>
</blockquote>
</body>
</html>