0
工作這是我的代碼:驗證不苡
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('ScriptName,TestSystem_id', 'required'),
array('TestSystem_id, TmatsUser_id, Active', 'numerical', 'integerOnly'=>true),
array('ScriptName, TestObjective, ScriptFormat, ComponentImpact', 'length', 'max'=>120),
array('Description, ScriptCode, ProvisionReq', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('id, TestSystem_id, TmatsUser_id, ScriptCode, ProvisionReq, ScriptName, Description, ScriptFormat, Active', 'safe', 'on'=>'search'),
);
}
但不工作的驗證。它給出了以下錯誤
CDbException
CDbCommand failed to execute the SQL statement: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'TestSystem_id' cannot be null
它根本不驗證ScriptName。
在數據庫中都被賦予爲NOT NULL。
的驗證在其他形式的正常工作。
任何幫助表示讚賞。
您可以張貼烏爾分貝結構 – 2012-01-19 14:09:02