Sprawdzanie poprawności CakePHP nie działa

Jestem nowy w cakephp, muszę zweryfikować formularz.

Oto kod: Kontroler:

<?php
class TasksController extends AppController {
    var $name = 'Tasks';
    var $helpers = array('Html','Form','Session');
     public function index(){
     }
    function add_task()
    {
        if(!empty($this->data)) {
            //print_r($this->data);
            $this->Task->set($this->data);
            if ($this->Task->validates()) {
                // it validated logic
                //echo "ttt";
            } else {
                // didn't validate logic
                echo $errors = $this->Task->validationErrors;
            }
        }
    }
}
?>

Model:

<?php
    class Task extends AppModel
    {
        public var $name = 'Task';
        var $useDbConfig = 'travanco_erp';
        public var $useTable = 'tbl_tasks'; // This model uses a database table 'exmp'
        public var $validate = array(
                    'task_title_mm' => array(
                            'rule' => 'notEmpty',
                            'required' => true,
                            'message' => 'The title field is required'
                    ),
                    'task_description_mm' => array(
                            'rule' => 'notEmpty',
                            'required' => true,
                            'message' => 'The description field is required'
                    ),
                    'task_from_mm' => array(
                            'rule' => 'notEmpty',
                            'required' => true,
                            'message' => 'The from date field is required'
                    ),
                    'task_to_mm' => array(
                            'rule' => 'notEmpty',
                            'required' => true,
                            'message' => 'The to date field is required'
                    )
            );

    }
?>

To jest widok:

<div class="employeeForm" style="width:64%; padding:10px 30%;"> 

            <?php echo $this->Form->create('test', array('class'=>'form'));?>
            <fieldset style="width:36em; padding:0px 0px;">
                    <div style="width:475px; font-family:Arial, Helvetica, sans-serif; font-size:16px; color:#333333; font-weight:bold; margin-left:20px; margin-top:10px;">Add Task</div>
                    <br/>
                <?php
                    /*echo $this->Form->input('task_ids_mm',        array(  'div'=>'frm_filed_new',
                                                                    'error' => array(   'wrap' => 'div',
                                                                                        'class' => 'formerror'
                                                                                    ),
                                                                    'label' => 'Task ID',
                                                                ));*/


                    echo $this->Form->input('task_title_mm',        array(  'div'=>'frm_filed_new',
                                                                    'error' => array(   'wrap' => 'div',
                                                                                        'class' => 'formerror'
                                                                                    ),
                                                                    'label' => 'Title',
                                                                ));


                    echo $this->Form->input('task_description_mm',  array(  'type' => 'textarea',
                                                                        'cols'=>60,
                                                                        'rows' => 5,
                                                                        'div'=>'frm_filed_new',
                                                                        'error' => array(   'wrap' => 'div',
                                                                                            'class' => 'formerror'
                                                                                    ),
                                                                        'label' => 'Description',
                                                                ));

                    echo $this->Form->input('task_from_mm',     array(  'div'=>'frm_filed_new','id'=>'task_from_mm','value'=>'',
                                                                    'error' => array(   'wrap' => 'div',
                                                                                        'class' => 'formerror'
                                                                                    ),
                                                                    'label' => 'From',
                                                                ));
                    echo $this->Form->input('task_to_mm',   array(  'div'=>'frm_filed_new','id'=>'task_to_mm','value'=>'',
                                                                    'error' => array(   'wrap' => 'div',
                                                                                        'class' => 'formerror'
                                                                                    ),
                                                                    'label' => 'To',
                                                                ));

                ?>  
                <br/>
                <?php echo $this->Form->button('Submit', array('type'=>'submit','escape'=>true)); ?>
            </fieldset>  
            <?php echo $this->Form->end(); ?>

        </div>

Walidacja nie działa.

Jaki jest błąd w moim kodzie? Jak mogę to rozwiązać?

EDYTOWAĆ:

Jest to błąd błędnej konfiguracji pliku databse.php. Teraz jest poprawionyprint_r($errors) wyświetla błędy.Ale to nie jest wyświetlane na stronie widoku, to znaczy w pobliżu pól tekstowych.

To jest ta tablica błędów:Array ( [task_title_mm] => Array ( [0] => The title field is required ) [task_description_mm] => Array ( [0] => The description field is required ) [task_from_mm] => Array ( [0] => The from date field is required ) [task_to_mm] => Array ( [0] => The to date field is required ) )

Jak mogę umieścić go w pobliżu pola tekstowego?

questionAnswers(3)

yourAnswerToTheQuestion