Have you tried
array('rule' => 'notEmpty', 'message' => '.....')
I.e. don't put the notEmpty into an array. This is the format in the
CookBook http://book.cakephp.org/view/338/Data-Validation
David
On Aug 24, 8:28 am, Juan Jose Marquez <[email protected]>
wrote:
> I have a small problem with the validation of some fields in a model
> The particular problem is that the system validates the data if the model
> but I painted the error messages in sight and it is not
> possible and have tried some things but nothing and I'm desperate.
> This is the code I have
>
>
> VISTA
> echo $form->create('usuariosaplicacion',array('url' =>
> '/clientes/add_acceso_aplicacion'))."\n";
> echo "<div id=\"div_usuario\">\n";
> echo "<label>Aplicación</label>\n";
> echo $form->input('usuariosaplicacion.id_aplicacion',
> array('label'=>false,'div'=>false,'empty'=>true,'options'=>$lista_aplicaciones))."\n";
> echo "</div>\n";
> echo $form->input('sm_precio_sms', array('label'=>Precio
> SMS,'size' => '5','maxlength'=>'4','div'=>false))."\n";
> echo $form->input('usuariosaplicacion.id_usuario',
> array('type'=>'hidden', 'value' => $id_cliente));
> echo $form->end('Submit');
>
> MODELO
> var $validate = array(
> 'id_aplicacion' => array(
> 'required' => array('rule' => array('notEmpty'),'message' =>
> 'Debe Seleccionar una aplicación')
> )
> );
>
> CONTROLADOR
>
> if (!empty($this->data)) {
> if ($this->usuariosaplicacion->save($this->data)) {
> $this->Session->setFlash(__('Se ha añadido el acceso a
> esta aplicacion correctamente', true));
> //$this->redirect(array('action'=>'index'));
> } else {
> $this->Session->setFlash(__('No se ha podido dar el
> acceso a esta aplicacion.', true));
> }
> }Do not know if this table will have something to do with this table
> is the table MIDDLE HABT a Relationship.
> A greeting and thank you very much
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---