Hi, I am new to Yii. I’m doing some tasks with the help of yii wiki and documentations. Now I have completed a form for employee details updation with validation. But I dont know where this validation process is actually going on.Even though I can see the script for validation. And how can I customize the error messages? Can anyone help me to catch this??
If I understand you, validation happens in rules() funtion in the model:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('FieldName', 'required'),
array('FieldName', 'unique'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('FieldName', 'safe', 'on'=>'search'),
);
}
You can set this function adding more validation rules.
If you mean with errors which appear if there are any empty field, I think you must change core messages.