0

Here are the 3 validation rule that are applied for "initials" field:

'initials' => array(
    'Not empty' => array(
        'rule' => 'notEmpty',
        'message'=>'Please enter a customer\'s initials'
    ),
    'Unique' => array(
        'rule' => array('isUniqueForCompany'),
        'message' => 'Customer with these initials already exists'
    ),
    'Long' => array(
        'rule' => array('between', 2, 12),
        'message' => 'Initials should be between 2 and 12 characters long'
    )
)

When creating a new record, all 3 rules are applied, but when updating/editting the 'Unique' rule is skipped out.

What can cause such a problem? If needed, I can provide the controller actions ar view forms.

4

1 に答える 1

1

isUniqueForCompanyモデルのカスタム検証関数に問題があることをお勧めします。

本来あるべきではないときに、おそらく true を返しています。

于 2013-09-05T10:47:58.893 に答える