This extention simplifies creation of three dropDownLists for collecting dates on models. Combines ehtmldataselect (manipulates dates under 1970-01-01) and activedatelist (adds behavour for onBeforeValidate).
works fine on Yii 1.1.7 or above
Extract the release file under protected/extensions
in view:
$this->widget('ext.ActiveDateSelect', array( 'model'=>$model, 'attribute'=>'birthdate', 'reverse_years'=>true, 'field_order'=>'DMY', 'start_year'=>1910, 'end_year'=>date("Y",time()), ) );
in controller:
$model=new User; if(isset($_POST['User'])){ $model->attributes=$_POST['User']; ActiveDateSelect::sanitize($model, 'birthdate'); if($model->validate()){ $model->save(); ... } }
Don't forget to import the class to your controller or to add the extention directory to your main config.
Total 1 comment
but you should import before use in controller
Leave a comment
Please login to leave your comment.