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
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
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
> 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.
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
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
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
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