I am looking for some advice on how best to add error messages (eg incorrect password / username) on a custom Login form.

Tried the usual routes for documentation but have seen nothing as yet - all help appreciated.


  • I'm having the same issue, following the docs with: {% if errorMessage is defined %} {{ errorMessage }} {% endif %} But receiving no error messages if email or password are invalid: melnet.org.nz/professionals
    – Ryan
    Jan 31 '15 at 7:50

Any login validation errors are passed back to the form and available via the Twig {{ errorMessage }} variable.

You can see an example of how to display them on a login form here: http://buildwithcraft.com/docs/templating/login-form

  • Thanks Brad - totally missed that and useful to know. Error messages may be a good section for the docs, as it's something always found in the other topic areas.
    – Dan G
    Sep 14 '14 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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