Take this exampple:
<div class="row">
<?php echo CHtml::activeLabelEx($model,'ora_inizio'); ?>
<?php echo CHtml::activeDropDownList($model,'ora_inizio', Pacchetto::getListaOre()); ?>
<?php echo CHtml::error($model,'ora_inizio'); ?>
</div>
//And this is the function
public static function getListaOre() {
$list = array();
for( $i = 0; $i < 24; $i++ ) {
if ( $i<10) $list[''+$i+'0'] = ''+$i+'0';
else $list[''+$i+''] = ''+$i+'';
}
return $list;
}
But it will render a dropdownlist with fields like
‘0’ => ‘0’,
‘1’ => ‘1’,
‘2’ => ‘2’,
I instead want this:
‘00’ => ‘00’,
‘11’ => ‘11’,
‘22’ => ‘22’,
‘33’ => ‘33’,