You have 'required' => true, which means the validation expects an array key 
for it in $this->data. Remove that from the validation and try again. notEmpty 
will still work; this checks that if the key 
$this->data['Client']['agt_number'] is present, it has a value.

See the yellow note here for a better explanation: 
http://book.cakephp.org/view/1147/required.

Jeremy Burns
Class Outfit

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

On 13 May 2011, at 11:55, heohni wrote:

> Hi,
> 
> I am saving client data, the client number has this rule:
> 'agt_nummer' => array(
>            'agt_nummer_not_empty' => array(
>                'rule'=> 'notEmpty',
>                'required' => true,
>                'message' => 'Dieses Feld darf nicht leer sein.'
>            ),
>            'agt_nummer_unique' => array(
>                'rule'=> 'isUnique',
>                'required' => true,
>                'message' => 'Dieser Wert liegt bereits in der
> Datenbank vor. Doppelte Eingaben sind nicht möglich.'
>            )
>        ),
> 
> My problem appears now in updating mode.
> 
> When I update any not required fields, all works fine.
> But when I update any of the required fields, like 'name' the rule
> 'agt_nummer_unique' is giving me an error.
> Which I find really strange... as I am not changing the agt_nummer
> field and I am on update mode not add.
> 
> Any ideas?
> Please?
> 
> -- 
> 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