activedateselect Combines ehtmldataselect and activedatelist

  1. Requirements
  2. Installation
  3. Usage

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).

Requirements

works fine on Yii 1.1.7 or above

Installation

Extract the release file under protected/extensions

Usage

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.

9 0
6 followers
872 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Date and Time
Developed by: klod
Created on: Apr 28, 2011
Last updated: 13 years ago

Downloads

show all

Related Extensions