I figured it out. $validationErrors contains the array, I simply set
it in the view.
// login.ctp
<?php echo $this->element('errors', array('errors' => $form-
>validationErrors['User'])); ?>
// elements/errors.ctp
<?php if (!empty($errors)) { ?>
<div class="failed">
<h5><?php printf(__d('errors', 'totalErrors', true), count
($errors)); ?></h5>
<ul>
<?php foreach ($errors as $field => $error) { ?>
<li><?php echo $error; ?></li>
<?php } ?>
</ul>
</div>
<?php } ?>
But since im doing i18n/l10n and am not able to do __() in the model
or the view, I had to do it in the controller.
// Validation
$this->User->validate = array(
'username' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => __d('errors', 'usernameEmpty2', true)
)),
'password' => array(
'notEmpty' => array(
'rule' => 'notEmpty',
'message' => __d('errors', 'passwordEmpty2', true)
)),
);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---