yii

yii lesson 3 form file

Drop Down List
echo $form->dropDownList($model,'payment',
array(''=>'','cash'=>'Cash','check'=>'Check','E-payment'=>'E-payment'))?>

Radio

echo $form->radioButtonList($model,'category',array(
'A-Motocycles'=>'A-Motocycles',
'B-Passenger cars'=>'B-Passenger cars',
'C-Vehicles over 7700 Lb'=>'C-Vehicles over 7700 Lb',
'D-Vehicles over 8 seats'=>'D-Vehicles over 8 seats',
'E-Truck it trailer'=>'E-Truck it trailer',
),
array(
'separator'=>' ',
'labelOptions'=>array('style'=>'display: inline; margin-right: 10px; font-weight: normal;'),
));

Date Picker

if($model->isNewRecord){
$date=date('Y-n-j');
}
else{

$date=$model->date;
}
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'model'=>$model,
'attribute'=>'date',

// additional javascript options for the date picker plugin
'options'=>array(
'showButtonPanel'=>true,
'changeYear'=>true,
'changeMonth'=>true,
'yearRange'=>'1950:2200',
'dateFormat'=>'yy-mm-dd',

'showAnim'=>'fold',
),
'htmlOptions'=>array(
'value'=>$date,
'style'=>'height:20px;'
),
));

Country

$x=array();
$x[]= ' ';
$y=CHtml::listData(Country::model()->findAll(),'id','name');
foreach($y as $index=>$value){

$x[$index]=$value;
}
echo $form->dropDownList($model,'countryid',$x);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s