Yii Framework Forum: DropDownList and '01', '02', '03' options, how? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

DropDownList and '01', '02', '03' options, how? Rate Topic: -----

#1 User is offline   StErMi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 259
  • Joined: 30-March 09

Posted 11 March 2010 - 01:30 PM

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',
0

#2 User is offline   StErMi 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 259
  • Joined: 30-March 09

Posted 11 March 2010 - 01:39 PM

.... sorry.... i've confused with Java ahuahauhauahuahaauahua

ok now it works, i used + instead of . <.<
0

#3 User is offline   Spyros 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 461
  • Joined: 14-April 09
  • Location:Athens - Greece

Posted 12 March 2010 - 12:38 AM

It happens to me all the time :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users