Yii Framework Forum: Bagaimana Set Atribut di CActiveForm - Yii Framework Forum

Jump to content

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

Bagaimana Set Atribut di CActiveForm Rate Topic: -----

#1 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 22 June 2010 - 06:42 AM

Mau nanya donk...
kan yang saya tau kalau saya mau upload file saya harus set atribut form enctype jadi 'multipart/form-data'
Nah di file _form.php defaultnya kan mereka pakainya CActiveForm bukan CHtml. Nah bagaimana caranya set atribut ke CActiveForm.
thx before :)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#2 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 22 June 2010 - 08:03 AM

Akhirnya saya menemukan sendiri setelah membaca baik-baik dokumentasi CActiveForm
dan menemukan bagian sini
Jadi ternyata kita bisa menambah atribut ke form dengan menggunakan property htmlOptions yang tersedia... dan untuk kasus saya supaya bisa upload maka yang harus diset cukup enctype. Jadi codingnya menjadi :

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'dek-article-form',
	'htmlOptions'=>array('enctype'=>'multipart/form-data'), 
	'enableAjaxValidation'=>false,
)); ?>


Jadi masalah dah terselesaikan :)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
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