This is then just a workaround in my oppinion and of course it would work.
But in other forms where I also use the isUnique operator for validation this problem doesn't show up. The difference is that there are no associated fields used. That is why I think the problem is in my validation call itself. Maybe someone has a little example how they do it. If I use the workaround this may cause inconsistent data. Thanks worthy On 1 Sep., 16:45, Preloader <[EMAIL PROTECTED]> wrote: > Hello again, > > ahm, may be you should put > > ‘on’ => ‘create’ > > to the validation rule of the email. > > So the isUnique rule only applies, when creating a new user record, > not when updating it. > > Have a look here:http://book.cakephp.org/view/125/data-validation#on-131 > > Regards, Christoph > > On 1 Sep., 16:37, worthy <[EMAIL PROTECTED]> wrote: > > > Hi Preloader and thanks for the fast answer. > > > I now added some more hidden fields and used the right name setting. > > > <?=$form->input('Customer.id', array('type'=>'hidden'));?> > > <?=$form->input('Customer.user_id', array('type'=>'hidden'));?> > > <?=$form->input('User.id', array('type'=>'hidden'));?> > > > This way the validation array looks like this: > > Array > > ( > > [User] => Array > > ( > > [email] => [EMAIL PROTECTED] > > [id] => 9 > > ) > > > [Customer] => Array > > ( > > [firm] => - > > [first_name] => Xxx > > [last_name] => Xxx > > [street] => Xxxx > > [nr] => 8 > > [plz] => 01234 > > [ort] => Xxxx > > [id] => 8 > > [user_id] => 9 > > ) > > > ) > > > I now tried 2 different validations with this array and both fail and > > tell me, that the email already exists. > > Those 2 are: > > > NR1: > > ------- > > $cleandata = $this->htmlchars($this->data); > > > $this->User->data=$cleandata; > > $this->Customer->data=$cleandata; > > > if($this->User->validates($cleandata) && $this->Customer- > > > >validates($cleandata)) { ... } > > > NR2: > > ------- > > $cleandata = $this->htmlchars($this->data); > > > $this->User->data=$cleandata; > > $this->Customer->data=$cleandata; > > > if($this->Customer->User->validates($cleandata) && $this->Customer- > > > >validates($cleandata)) { ... } > > > As I said above both of them fail. > > > I did not try saveAll() yet because I have to make the validation work > > first. > > > Greetings worthy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
