Form errors / validation not working when using custom theme

Permalink 1 user found helpful
So I've added the following code to the page
/application/config/app.php
<?php
return array(
    'theme_paths'         => array(
        '/login'            => 'my_theme',
        '/register'            => 'my_theme'
    ),
);


And it's working, in so far as now my login page and register page look all nice like my theme. However if someone enters the incorrect information or misses a required field the validation messages aren't showing. The page just reloads and no error messages are shown.
I'm wondering if I need to change the path to the form validation but I don't know how or where. Can anyone help?
Thanks

rosie607
 
hutman replied on at Permalink Best Answer Reply
hutman
In the view.php in your theme, do you have this line (this is from 5.8.1 but other versions should be similar)?

<?php  View::element('system_errors', array('format' => 'block', 'error' => isset($error) ? $error : null, 'success' => isset($success) ? $success : null, 'message' => isset($message) ? $message : null)); ?>
rosie607 replied on at Permalink Reply
rosie607
Wow thank you so much :-)
One line and it worked perfectly.
Thanks!
mckoenig replied on at Permalink Reply
mckoenig
I'm having the same problem with version 5.7.5.9. After submitting a form with invalid data the page just reloads. I can verify the controller is picking up on the fields and filling an error variable but I can't get it to display in my theme. I've added the View element like so:
<div class="main_content">
            <?php  
                $a = new Area('Content');
                $a->display($c);    
            ?>  
            <?php
         View::element(
             'system_errors',
             array(
                 'format' => 'block',
                 'error' => isset($error) ? $error : null,
                 'success' => isset($success) ? $success : null,
                 'message' => isset($message) ? $message : null,
             )
         );


but that didn't help.
mckoenig replied on at Permalink Reply
mckoenig
I can confirm that the variables $formResponse and $errors are not passed to the view.php in the /forms/ block. Is there any step inside the theme setup responsible for passing those correctly?