Displaying error message

1

I made the following validations in the Model:

class Inscricao extends AppModel
{
    public $name = 'Inscricao';
    public $useTable = 'inscricoes';

    public $validate = array(

        'nome' => array(
            'between' => array(
                'rule' => array('between', 5, 15),
            'message' => 'Entre 5 e 15 caracteres'
            ),
            'isUnique' => array(
                'rule' => 'isUnique',
            'message' => 'Nome já Cadastrado'
            )
        ),

The rules are working all right. In the View I put the following:

                        $this->Form->input('nome',
                            [
                                'between'     => '<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>',
                                'type'        => 'text',
                                'class'       => 'form-control',
                                'placeholder' => 'Nome',
                                'required'    => false,
                                'label'       => false,
                                'div'         => false,
                                'error' => array(
                                    'between' => __('Minimo 5 Caracteres', true),
                                    'isUnique' => __('Nome já cadastrado', true)
                                    ),
                            ]);

But it does not even print an error message.

In the Controller I made this the set :

class InscricoesController extends AppController
{
    public $name = 'Inscricoes';
    public $uses = array('Inscricao');

    public function add()
    {
        if($this->request->data)
        {
            if($this->Inscricao->save($this->request->data))
                $this->Session->setFlash('<b>Enviado com Sucesso!</b>');
                $this->redirect($this->referer());
        }
    }
}

When the data is valid it prints the 'Successfully Sent' message right.

    
asked by anonymous 17.07.2015 / 15:54

0 answers