Thanks, I can't believe the solution was so simple! With saveAll() the
data gets validated just as I needed. Thanks!!

The only changes I had to do were in the controller
/////// IN THE CONTROLLER function listProducts()
<?php
function listProducts()
if( !empty($this->data) )
{
$this->Product->set($this->data);
        if( $this->Product->saveAll($this->data) )
        {
             $this->Session->setFlash('Product Saved.');
             $this->redirect(array('action' => 'listProducts'));
        }
        else
        {
              $this->Session->setFlash('Error saving product!');
              $this->redirect(array('action' => 'listProducts'));
        }
}
?>

On Mar 10, 10:35 am, Sam Bernard <sambern...@gmail.com> wrote:
> You *should* be able to do this with "saveAll". saveAll will validate your
> records and then try to save all the records in a single transaction, so you
> don't have to validate first and then perform a transaction.
>
> If for some reason you wanted to validate separately- just do:
> $this-> Product->saveAll($this->data['Product'], array('validate' =>
> 'only'))
> to just perform validation on your records
>
> http://book.cakephp.org/view/1031/Saving-Your-Data

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to