Q:

Yii split dropdownlist

I would to split a single CActiveForm TextField  in 3 Dropdownlist fields (year, month and day).
I try this code:
echo CHtml::activeDropDownList($model,'day', $model->getDays());
echo CHtml::activeDropDownList($model,'month', $model->getMonths());
echo CHtml::activeDropDownList($model,'year', $model->getYears());

but model not recognize 'day', 'month' and 'year' field because is not define in data model.
Is there a way to create fields that are not dependent on a model?

A:

Define this three fields as variable in model like
class myTable extends CActiveRecord
{
   public $day;
   public $month;
   public $year;
}

then you would able to use in your CActiveForm. And Combine this three field on Post in your controller before calling $model->save();.

