0

Using the standard P&T contact form, I'm getting the following error when form is submitted (running locally):

Twig_Error_Runtime

Impossible to access an attribute ("fromEmail") on a string variable ("") in "_layout" at line 149 (C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php:460)

#0 C:\xampp\htdocs\mysite\craft\app\etc\templating\BaseTemplate.php(41): Twig_Template->getAttribute('', 'fromEmail', Array, 'any', false, false)
#1 C:\xampp\htdocs\mysite\craft\storage\runtime\compiled_templates\3\5\352f325e7c58d6329a0dbf553a172b2811c881b391a544d0f295665ec793e2af.php(251): Craft\BaseTemplate->getAttribute('', 'fromEmail', Array)
#2 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(340): __TwigTemplate_352f325e7c58d6329a0dbf553a172b2811c881b391a544d0f295665ec793e2af->doDisplay(Array, Array)
#3 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(314): Twig_Template->displayWithErrorHandling(Array, Array)
#4 C:\xampp\htdocs\mysite\craft\storage\runtime\compiled_templates\2\a\2a1532ab9a7fc5ec6775a274eca668a2af4e295ac7764368b23c762497284924.php(27): Twig_Template->display(Array, Array)
#5 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(340): __TwigTemplate_2a1532ab9a7fc5ec6775a274eca668a2af4e295ac7764368b23c762497284924->doDisplay(Array, Array)
#6 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(314): Twig_Template->displayWithErrorHandling(Array, Array)
#7 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Template.php(325): Twig_Template->display(Array)
#8 C:\xampp\htdocs\mysite\craft\app\vendor\twig\twig\lib\Twig\Environment.php(293): Twig_Template->render(Array)
#9 C:\xampp\htdocs\mysite\craft\app\services\TemplatesService.php(223): Twig_Environment->render('404', Array)
#10 C:\xampp\htdocs\mysite\craft\app\controllers\BaseController.php(74): Craft\TemplatesService->render('404', Array)
#11 C:\xampp\htdocs\mysite\craft\app\controllers\TemplatesController.php(201): Craft\BaseController->renderTemplate('404', Array)
#12 C:\xampp\htdocs\mysite\craft\app\framework\web\actions\CInlineAction.php(49): Craft\TemplatesController->actionRenderError()
#13 C:\xampp\htdocs\mysite\craft\app\framework\web\CController.php(308): CInlineAction->runWithParams(Array)
#14 C:\xampp\htdocs\mysite\craft\app\framework\web\CController.php(286): CController->runAction(Object(CInlineAction))
#15 C:\xampp\htdocs\mysite\craft\app\framework\web\CController.php(265): CController->runActionWithFilters(Object(CInlineAction), Array)
#16 C:\xampp\htdocs\mysite\craft\app\framework\web\CWebApplication.php(282): CController->run('renderError')
#17 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(368): CWebApplication->runController('templates/rende...')
#18 C:\xampp\htdocs\mysite\craft\app\etc\errors\ErrorHandler.php(264): CErrorHandler->renderError()
#19 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(351): Craft\ErrorHandler->renderError()
#20 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(218): CErrorHandler->renderException()
#21 C:\xampp\htdocs\mysite\craft\app\etc\errors\ErrorHandler.php(128): CErrorHandler->handleException(Object(Craft\HttpException))
#22 C:\xampp\htdocs\mysite\craft\app\framework\base\CErrorHandler.php(131): Craft\ErrorHandler->handleException(Object(Craft\HttpException))
#23 C:\xampp\htdocs\mysite\craft\app\framework\base\CApplication.php(740): CErrorHandler->handle(Object(CExceptionEvent))
#24 [internal function]: CApplication->handleException(Object(Craft\HttpException))
#25 {main}

Running latest Craft Pro 2.4.2700 and latest contact form plugin. What could be causing the error?

2
  • 1
    What does your markup look like at "_layout" at line 149"?
    – Damon
    Commented Oct 21, 2015 at 13:27
  • Line 149 was {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}, but I think I found the issue. See below :) Commented Oct 21, 2015 at 17:47

1 Answer 1

1

The problem was that the redirect page was not setup. Once I threw up a test page there, the error no longer triggers.

What's odd is that the error page gave little clue (at least to me) as to what was happening.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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