If you are correctly validating within the model, add this to your app_model.php file: function validates($options = array()) { // Debug validation $errors = $this->invalidFields($options); if (is_array($errors) && !empty($errors)) { $this->log($errors, 'debug'); } // Validate return parent::validates($options); }
Afterwards check /app/logs/debug.log for validation errors that might have occured after you trigger a validation (or save) On Oct 29, 10:08 pm, Will Poillion <lorew...@gmail.com> wrote: > Simple question: > > I'm attempting to save a model, and the data to be saved is not > passing the validation rules. How do I retrieve the validation error? > > if ($this->Ingredient->IngredientImage->save($this->data)) { > //success > $this->Session->setFlash(__('The Ingredient Image has been saved', > true));} else { > > // retrieve validation error and return to view > > } > > Also, am I correct in assuming that setFlash is useless in an ajax > call? I know I'm a noob but I'm not sure how I would use the setflash > and flash functionality in an ajax call. Any clue as to how to do this > would be most appreciated. > > Thanks! > Will --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---