Re: How Check validate before save

2011-12-01 Thread phpMagpie
Adding 'validate'=>'only' will never save as your asking the function to only validate the data. If 'incorrect' data is passing validating then you have something wrong with your validation rules. Paul. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Chec

Re: How Check validate before save

2011-11-30 Thread euromark
I dont understand your code - where do you actually save your data? as of right now you only validate it... On 30 Nov., 12:17, Mamdoohi wrote: > ok. > I have two model ( user, employee ). > and use this code > > if($this->Employee->saveAll($this->data,array('validate'=>'only')){ >     $this->Ses

Re: How Check validate before save

2011-11-30 Thread Mamdoohi
ok. I have two model ( user, employee ). and use this code if($this->Employee->saveAll($this->data,array('validate'=>'only')){ $this->Session->setFlash('Saved'); $this->redirect('/'); }else{ $this->Session->setFlash('error'); } but when send incorrect data, saveAll method don't save d

Re: How Check validate before save

2011-11-30 Thread phpMagpie
> As others have said when you call your models save() method it will check validation by default. save() will not validate associated data as it only saves the current model. As I stated previously saveAll() will validate associated model data in a properly formatted data array. HTH, Paul.

Re: How Check validate before save

2011-11-29 Thread andrewperk
Hi Mamdoohi, As others have said when you call your models save() method it will check validation by default. But if for whatever reasons you want to do manual validation, here's a few methods that I found extremely helpful: $this->YourModel->set($this->request->data); You can use your models set

Re: How Check validate before save

2011-11-29 Thread phpMagpie
CakePHP will do this for you automagically when using Model::saveAll(). HTH, Paul. -- 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 uns

Re: How Check validate before save

2011-11-27 Thread euromark
does this help? http://www.dereuromark.de/2010/06/20/validating-multiple-models-at-once/ On 27 Nov., 09:02, Mamdoohi wrote: > hi > I want validate data before save. > my data is for two table so I want check validate then save data into two > table > > how can do it? -- Our newest site for the

How Check validate before save

2011-11-27 Thread Mamdoohi
hi I want validate data before save. my data is for two table so I want check validate then save data into two table how can do it? -- 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 othe