Yii Framework Forum: [Solved] Mengganti Textfield Ke Dropdownlist - Yii Framework Forum

Jump to content

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

[Solved] Mengganti Textfield Ke Dropdownlist Rate Topic: -----

#1 User is offline   Aboe Fatimah 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 23-November 11

Posted 15 November 2012 - 05:17 PM

langsung saja,

saya masih baru nih dengan yii, saya mencoba merubah halaman Generate CRUD oleh gii, yakni merubah kolom TextField dengan DropDownList tapi ketika saya coba malah keluar error "id tipe cannot be blank" selain di view di halaman mana lagi yah yang perlu saya rubah?

Code Awal :
	<?php echo $form->labelEx($model,'id_tipe'); ?>
	<?php echo $form->textField($model,'id_tipe'); ?>
	<?php echo $form->error($model,'id_tipe'); ?>


dirubah menjadi :
	<?php
	$data = CHtml::listData( Ttipe::model()->findAll(),'id','nama' )
	?>
		<?php echo $form->labelEx($model,'id_tipe'); ?>
		<?php echo CHtml::dropDownList('id_tipe', $model, $data);?>
		<?php echo $form->error($model,'id_tipe'); ?>
	</div>



mohon pencerahannya. Terima Kasih.
0

#2 User is offline   xent 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 97
  • Joined: 14-November 10

Posted 15 November 2012 - 08:13 PM

coba pake $form->dropDownList(...)

formatnya
dropDownList
dropDownList($model, 'id_tipe', $data)

xent

My first app: School Information System
Find error? Post here
My Blog
0

#3 User is offline   Aboe Fatimah 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 23-November 11

Posted 15 November 2012 - 08:22 PM

View Postxent, on 15 November 2012 - 08:13 PM, said:

coba pake $form->dropDownList(...)

formatnya
dropDownList
dropDownList($model, 'id_tipe', $data)



terima kasih banyak, now solved
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