我是新手YII
。我创建了一个带有文本字段的表格并创建了模型和 crud 生成器,我为日期创建了文本字段。然后我用 datepicker 替换了它,但我不知道如何将我的新 datepicker 与模型连接起来。
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('name, gender, age, dob, doj, class,
no_seats, train_name, proof_1, proof_2, proof_3', 'required'),
array('age, class, no_seats', 'numerical', 'integerOnly'=>true),
array('name', 'length', 'max'=>20),
array('gender', 'length', 'max'=>6),
array('train_name', 'length', 'max'=>23),
//I created the below statement instead of the previous //one
//created for text field but it is not working
array('dob','date','format'=>Yii::app()->
locale->getDateFormat('medium')),
array('proof_1', 'length', 'max'=>7),
array('proof_2', 'length', 'max'=>8),
array('proof_3', 'length', 'max'=>9),
array('status', 'length', 'max'=>1),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('refid, name, gender, age, dob, doj,
class, no_seats, train_name, proof_1, proof_2,
proof_3, created, lastmodified, status', 'safe', 'on'=>'search'),
);
}