Let's go back to basics a bit.

Is agent_id the primary key of your table?

What does $this->data look like when you submit the form?

Wat do your validation rules look like now?

Jeremy Burns
Class Outfit

[email protected]
http://www.classoutfit.com

On 13 May 2011, at 13:09, heohni wrote:

> OK, but even I do
> 
> echo $form->hidden('agent_id');
> which will output: <input type="hidden" name="data[Agent][agent_id]"
> id="AgentAgentId" />
> 
> The isUnique rule will take place as soon as I modify any of my
> fields.
> 
> This drives me mad :-(
> 
> 
> 
> On 13 Mai, 13:57, Jeremy Burns | Class Outfit
> <[email protected]> wrote:
>> You need to place an id field in your form using the form helper. Without 
>> it, Cake will assume you are doing an insert, not an update.
>> 
>> Jeremy Burns
>> Class Outfit
>> 
>> [email protected]http://www.classoutfit.com
>> 
>> On 13 May 2011, at 12:55, heohni wrote:
>> 
>> 
>> 
>>> No, there is no id field.
>>> I double checked beforeValidate() and debuged $this->data. There is no
>>> id field.
>>> The id is given within the URL when entering the update form, but with
>>> the first submit and upcoming error messages, the ID gets lost within
>>> the URL.
>> 
>>> 'agt_nummer_uni'=>array(
>>>                'rule'=> array('checkUnique'),
>>>                'message'=> 'Duplikat! Diese Agentur Nr. wurde bereits
>>> gespeichert.'
>>>                )
>> 
>>> function checkUnique($data) {
>>>        //debug($data);
>>>        return $this->isUnique(array('agt_nummer' => $this-
>>>> data['Agent']['agt_nummer']));
>>>    }
>> 
>>> --
>>> Our newest site for the community: CakePHP Video 
>>> Tutorialshttp://tv.cakephp.org
>>> Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
>>> others with their CakePHP related questions.
>> 
>>> To unsubscribe from this group, send email to
>>> [email protected] For more options, visit this group 
>>> athttp://groups.google.com/group/cake-php
> 
> -- 
> 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
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to