Hi everyone, this one is puzzling me. In my app, validation works like a charm for every model I have, except one. In that one, validation works but...., here the rules:
var $validate = array( 'name' => array( 'rule' => 'alphaNumeric', 'required' => true, 'message' => 'Il campo codice GP deve essere alfanumerico', 'allowEmpty' => false ), 'customer_name' => array( 'rule' => 'alphaNumeric', 'required' => true, 'message' => 'Il campo codice cliente deve essere alfanumerico', 'allowEmpty' => false ), 'grammatura' => array( 'rule' => 'numeric', 'message' => 'la grammatura deve essere un numero intero', 'allowEmpty' => false ) ); As I was telling you, validation works. In fact, if I leave any of those three fields empty, data aren't saved in the database. The problem is the message that doesn't show! Even worse, I get the flash message from the controller that everything has been saved correctly (when is not)! Here is the controller add action as backed via console and modified: function add() { if (!empty($this->data)) { $this->Distint->create(); $this->Distint->bindModel(array('hasMany'=>array('DistintsMaterial','DistintsOperation','DistintsMachine','DistintsExtop'))); $this->Distint->save($this->data); $this->Session->setFlash(__('La distinta base รจ stata salvata', true)); $this->redirect(array('action'=>'index')); } The thing is I had to bind those models to this one on the fly, because in the habtm tables I have extra fields to save data within. I suspect this binding being the reason of my troubles. No matter what you do with the aforementioned validation rules, the only message you'll get is the one in the setFlash. Have you any idea about how to fix this? 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---