Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for some help with persistent form data.

If a user submits a front-end entry form for some Entries data, but there are errors with the submission, they are currently redirected to the entry page and successfully shown the errors (eg field is required). Is there a method or syntax where this form can also retrieve the posted form data so the user is not required to fill in the whole form again?

Many thanks for any help from the community!


share|improve this question
up vote 2 down vote accepted

I've updated our front-end entry template example to show you how this can be done:

share|improve this answer
Thanks Brad that is very good, and helpful. – Dan G Aug 12 '14 at 14:16

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:

    value="{{ entry is defined ? entry.title : '' }}",

You can also retrieve the errors from the entry variable:

{% if (entry is defined) and (entry.hasErrors('title')) %}
    <span class="error">{{ entry.getError('title') }}</span>
{% 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.


  1. Take a look at line 477 of craft/app/controllers/EntriesController.php
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.