Saturday, October 3, 2009

Re: Validator message not showing

Are you setting that flash message yourself ?

You can check if a save has been succesfull or not by looking at the response that comes back from the $model->save() method ... either true or false.


On Fri, Oct 2, 2009 at 4:46 PM, Cristian Cassina <principesso76@gmail.com> wrote:

Hi everyone,
I'm dealing  with a little problem that I can't simply get rid of.
I have these validation rules in the required model:

 var $validate = array(
               'name' => array(
                   'rule' => 'notEmpty',
                   'message' => 'Il campo codice non può essere
lasciato vuoto'
               ),
               'customer_name' => array(
                 'rule' => 'notEmpty',
                 'message' => 'Il codice cliente non può essere vuoto'
               ),
               'grammatura' => array(
                 'rule' => array('notEmpty', 'numeric'),
                 'message' => 'la scheda deve avere una grammatura'
               )
               );

I probably didn't get the thing right, but if I try to submit the view
with any of these fields empty, it flashes me "Object has been saved
correctly", while it didn't save anything.
What am I doing wrong? Is the setFlash method totally independent from
the error message in the validator?
Thank you

Cristian




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: