Yii Framework Forum: Jappendo Dengan Upload + Cjuidialog - Yii Framework Forum

Jump to content

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

Jappendo Dengan Upload + Cjuidialog Rate Topic: -----

#1 User is offline   mrkoeh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 31-October 12
  • Location:Indonesia

Posted 06 May 2013 - 01:46 AM

permisi gan,
saya lgi stuck ni,saya punya form tambah kya gni :
Attached File  Capture.PNG (11.44K)
Number of downloads: 37

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,
		));
	}

0

#2 User is offline   ahmadroni 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 250
  • Joined: 14-June 09
  • Location:Yogyakarta-Indonesia

Posted 09 May 2013 - 05:05 AM

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



1. ketika klik tombol "get dokter" yg kedua dengan CJuiDialog yg terisi tetep textfield pertama
=> ini karena tombol Get Dokter tidak mendapatkan Index, maka selelau mengarah ke Index yang ke 0,
<br style="background-color: rgb(250, 251, 252);">2. upload file tidak berjalan
=> untuk Upload File, kayaknya sudah ada di Forum, coba cari lg dulu aja
Hospital Cost Management System and
Hospital Management Information System
0

#3 User is offline   mrkoeh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 31-October 12
  • Location:Indonesia

Posted 09 May 2013 - 08:31 PM

View Postahmadroni, on 09 May 2013 - 05:05 AM, said:

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



1. ketika klik tombol "get dokter" yg kedua dengan CJuiDialog yg terisi tetep textfield pertama
=> ini karena tombol Get Dokter tidak mendapatkan Index, maka selelau mengarah ke Index yang ke 0,
<br style="background-color: rgb(250, 251, 252);">2. upload file tidak berjalan
=> untuk Upload File, kayaknya sudah ada di Forum, coba cari lg dulu aja


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
0

#4 User is offline   mrkoeh 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 42
  • Joined: 31-October 12
  • Location:Indonesia

Posted 27 May 2013 - 08:25 PM

gan,
klo ada proses upload di jappendo gmna yah??
ane nyoba2 kok gak pnh jadi. .
terimakasih. . .
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