Jappendo Dengan Upload + Cjuidialog

permisi gan,

saya lgi stuck ni,saya punya form tambah kya gni :

4213

Capture.PNG

lha msalahny :

  1. ketika klik tombol "get dokter" yg kedua dengan CJuiDialog yg terisi tetep textfield pertama

  2. upload file tidak berjalan

apkah ad solusi??

form appendo :




<table class="appendo-gii" id="<?php echo $id ?>">

	<thead>

		<tr>

			<td>Nama</td>

			<td>Tanggal</td>

			<td>File</td>

		</tr>

	</thead>

	<tbody>

    <?php if ($model->nama_dokter == null): ?>

		<tr>

			<td>

				<?php echo CHtml::hiddenField('kd_dokter[]','',array('id'=>'kd_dokter')); ?> 

				<?php echo CHtml::textField('nama_dokter[]','',array('id'=>'nama_dokter')); ?> 

				<?php echo CHtml::Button('x', array('name' => 'del_people', 'id' => 'del_people', 'onclick' => '$("#nama_dokter").val("");$("#kd_dokter").val("")')) ?>

				<?php echo CHtml::Button('Get Dokter', array('onclick' => '$("#dialogdokter").dialog("open"); return false;',)); ?>

			</td>

            <td>

				<?php echo CHtml::dropDownList('bulan[]',"string",

					array("1"=>"Januari",

						  "2"=>"Februari",

						  "3"=>"Maret",

						  "4"=>"April",

						  "5"=>"Mei",

						  "6"=>"Juni",

						  "7"=>"Juli",

						  "8"=>"Agustus",

						  "9"=>"September",

						  "10"=>"Oktober",

						  "11"=>"November",

						  "12"=>"Desember",),

					array('style'=>'width:100px'));

				?>

			</td>

			<td>

				<?php echo CHtml::fileField('nama_file[]',''); ?>

			</td>

		</tr>

    <?php else: ?>

        <?php for($i = 0; $i < sizeof($model->nama_dokter); ++$i): ?>

    		<tr>

    			<td>

					<?php echo CHtml::hiddenField('kd_dokter[]',$model->enum_name[$i],array('id'=>'kd_dokter')); ?> 

					<?php echo CHtml::textField('nama_dokter[]',$model->enum_name[$i],array('style'=>'width:120px')); ?>

				</td>

                <td>

					<?php

					$this->widget('zii.widgets.jui.CJuiDatePicker', array(

						'name'=>'tgl_upload[]',

						'value'=>$model->enum_name[$i],

						 'options'=>array(

							'showAnim'=>'fold',

							'dateFormat'=>'yy-mm-dd',

						),

						'htmlOptions'=>array(

							'style'=>'height:20px;'

						),

					));

					?>

				</td>

                <td>

					<?php echo CHtml::fileField('nama_file[]',$model->enum_name[$i]); ?>

                </td>

            </tr>

        <?php endfor; ?>

		<tr>

			<td>

				<?php echo CHtml::hiddenField('kd_dokter[]','',array('id'=>'kd_dokter')); ?> 

				<?php echo CHtml::textField('nama_dokter[]','',array('id'=>'nama_dokter')); ?> 

				<?php echo CHtml::Button('x', array('name' => 'del_people', 'id' => 'del_people', 'onclick' => '$("#nama_dokter").val("");$("#kd_dokter").val("")')) ?>

				<?php echo CHtml::Button('Get Dokter',  

						array('onclick' => '$("#dialogdokter").dialog("open"); return false;',  

					));  

				?>

			</td>

            <td>

				<?php

				$this->widget('zii.widgets.jui.CJuiDatePicker', array(

					'name'=>'tgl_upload',

					'value'=>isset(Yii::app()->request->cookies['tgl_upload']) ? Yii::app()->request->cookies['tgl_upload'] : '',

					 'options'=>array(

						'showAnim'=>'fold',

						'dateFormat'=>'yy-mm-dd',

					),

					'htmlOptions'=>array(

						'style'=>'height:20px;'

					),

				));

				?>

			</td>

			<td>

				<?php echo CHtml::fileField('nama_file[]',''); ?>

			</td>

		</tr>

    <?php endif; ?>

	</tbody>

</table>

<?php

$this->beginWidget('zii.widgets.jui.CJuiDialog', array( // the dialog

	'id'=>'dialogdokter',

	'options'=>array(

		'title'=>'Daftar Dokter',

		'autoOpen'=>false,

		'modal'=>true,

		'width'=>550,

		'height'=>470,

	),

)); 

echo $this->render('loadDokter', array('model'=>$model));

?>

<div class="divForForm"></div>

<?php $this->endWidget();?>



controller :




public function actionCreate()

	{

		$model=new FilePendapatan;

		

		if(isset($_POST['nama_dokter']))

		{

			//$model->attributes=$_POST['nama_dokter'];

			//$nama_file = CUploadedFile::getInstances($model,'nama_file');

			$total = count($_POST['nama_dokter']);

		    for ($i = 0; $i <= $total; $i++)

		    {

		    	if(isset($_POST['nama_dokter'][$i]))

		    	{

		     		$file_add = new FilePendapatan();

		        	$file_add->kd_dokter = $_POST['kd_dokter'][$i];

					$file_add->nama_dokter = $_POST['nama_dokter'][$i];

		        	$file_add->tgl_upload = $_POST['tgl_upload'][$i];

		        	//$file_add->nama_file = $_POST['nama_file'][$i];

		         	$file_add->save();

		    	}

		    }

		    if ($model->save()) {

				//$model->nama_file->saveAs(Yii::app()->basePath .'/../file/' . $model->nama_file);

				$this->redirect(array('view','id'=>$model->id));

			}

		}

		$this->render('create',array(

			'model'=>$model,

		));

	}



mungkin bisa membantu…




<?php echo CHtml::Button('Get Dokter', array('id'=>'getDokter[]','onclick' => '$("#dialogdokter").dialog("open"); return false;'));  ?>



[color="#1C2837"][size="2"]1. ketika klik tombol "get dokter" yg kedua dengan CJuiDialog yg terisi tetep textfield pertama[/size][/color]

=> ini karena tombol Get Dokter tidak mendapatkan Index, maka selelau mengarah ke Index yang ke 0,

<br style="background-color: rgb(250, 251, 252);">[color="#1C2837"][size="2"]2. upload file tidak berjalan[/size][/color]

[color="#1C2837"][size="2"]=> untuk Upload File, kayaknya sudah ada di Forum, coba cari lg dulu aja[/size][/color]

terimaksih gan atas responny.

udah ane cba tpi tetep gk berubah, yg keisi tetep textfield yg pertama. .

apkah ad solusi??

untuk smentara ane pake dropdown list untuk daftar dokter,tp data masih sedikit.hehe. .

yg upload udah ane cari gak nemu gan. .haduuh

gan,

klo ada proses upload di jappendo gmna yah??

ane nyoba2 kok gak pnh jadi. .

terimakasih. . .