Persistent Form Data
If there are any problems with your submission, Craft sets an entry route variable1, which you can use to retrieve the previously-posted form data.

Here's an example of how you might do that:

&lt;input
    id="title"
    type="text"
    name="title"
    value="{{ entry is defined ? entry.title : '' }}",
&gt;


You can also retrieve the errors from the entry variable:

{% if (entry is defined) and (entry.hasErrors('title')) %}
    &lt;span class="error"&gt;{{ entry.getError('title') }}&lt;/span&gt;
{% endif %}


If you want to learn more about the validation-related methods available on the entry object (such as the difference between getError and getErrors), I've written a blog post on the subject.

Stephen


Take a look at line 477 of craft/app/controllers/EntriesController.php