[Ask] Operasi 2 Form Pake Tabs

dari sdr dst34m

bisa paste hasil render viewnya? bagian tag <form …> aja sampe </form>

ini form-form yang di render om

_form.php :




<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(

	'id'=>'employee-form',

	'enableAjaxValidation'=>false,

	'htmlOptions' => array('enctype' => 'multipart/form-data'),

)); ?>

<div class="widget-box">

	<div class="widget-title">

		<h5> Informasi Pribadi</h5>

		

	</div><!-- End Of widget-title -->

	<div class="widget-content">

		<?php echo $form->errorSummary($model); ?>

		<?php echo $form->textFieldRow($model,'EMP_ID',array('class'=>'span2','maxlength'=>50)); ?>

		<div class="row-fluid">

			<div class="span4">

				<?php echo $form->textFieldRow($model,'EMP_NAME',array('maxlength'=>50)); ?>

			</div>

			<div class="span4">

				<?php echo $form->labelEx($model,'EMP_BIRTH_DATE'); ?>

				<?php 

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

						'attribute'=>'EMP_BIRTH_DATE',

						'model'=>$model,

						// additional javascript options for the date picker plugin

						'options'=>array(

							'mode'=>'focus',

							'showAnim'=>'bounce',

							'flat'=>true,

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

							/*'buttonText'=>yii::t('ui','tentukan tanggal'),

							'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

							'buttonImageOnly'=>true,*/

							'changeMonth'=>true,

							'changeYear'=>true,

							'yearRange'=>'1900:2099',

							'showButtonPanel'=>true,

						),

						'htmlOptions'=>array(

							'style'=>'height:20px; width:150px; text-align:center;',

							'prepend'=>'<i class="icon-search"></i>',

						),

						

					));

				?>

			</div>

			<div class="span3">

				<?php echo $form->textFieldRow($model,'EMP_BIRTH_PLACE',array('maxlength'=>20)); ?>

			</div>

		</div><!-- end of first Row Fluid -->

							

		<div class="row-fluid">

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_GENDER',array('prompt'=>'---Pilih Jenis Kelamin---', 'Laki-laki'=>'Laki-laki', 'Perempuan'=>'Perempuan')); ?>

			</div>	

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_MARRIAGE',array('prompt'=>'----- Pilih Status -----','Belum Menikah'=>'Belum Menikah','Menikah'=>'Menikah')); ?>

			</div>

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_RELIGION',array('prompt'=>'----- Pilih Agama -----','Islam'=>'Islam','Kristen'=>'Kristen','Katolik'=>'Katolik','Hindu'=>'Hindu','Budha'=>'Budha')); ?>

			</div>

		</div> <!-- end of second row-fluid -->

						

				<?php echo $form->textAreaRow($model,'EMP_ADDRESS',array('class'=>'span8', 'rows'=><img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />); ?>

				<?php echo $form->textAreaRow($model,'EMP_ADDRESS_2',array('class'=>'span8', 'rows'=><img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />); ?>


		<div class="row-fluid">

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_PROVINCE_ID', CHtml::listData(PROVINCE::model()->findAll(), 'PROVINCE_ID','PROVINCE_NAME'),array(

							'prompt'=>'----- Pilih Propinsi -----',

							'ajax'=>array(

								'type'=>'POST',

								'url'=>CController::createUrl('filterkota'),

								'update'=>'#EMPLOYEE_EMP_CITY_ID',

							'data'=>array('EMP_PROVINCE_ID'=>'js:this.value'),

						)

					)); 

				?>

			</div>

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_CITY_ID', empty($model->EMP_PROVINCE_ID)? array() :CHtml::listData(CITY::model()->findAll('CITY_PROVINCE_ID='.$model->EMP_PROVINCE_ID), 'CITY_ID', 'CITY_NAME'),

								array('prompt'=>'----- Pilih Kota -----')); ?>

			</div>

			<div class="span3">

				<?php echo $form->textFieldRow($model,'EMP_POSTAL_CODE',array('class'=>'span5')); ?>

			</div>

		</div><!-- end of thirth row-fluid -->

						

		<div class="row-fluid">

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_COUNTRY_ID',CHtml::listData(COUNTRY::model()->findAll(), 'COUNTRY_ID','COUNTRY_NAME'),array('prompt'=>'----- Pilih Negara -----')); ?>

			</div>

			<div class="span3">

				<?php echo $form->textFieldRow($model,'EMP_NATIONALITY',array('class'=>'span10','maxlength'=>35)); ?>

			</div>

		</div><!-- end of forth row-fluid -->

						

		<div class="row-fluid">

			<div class="span4">

				<?php echo $form->textFieldRow($model,'EMP_ID_CARD',array('class'=>'span8')); ?>

			</div>

			<div class="span4">

				<?php echo $form->labelEx($model,'EMP_ID_CARD_PERIOD'); ?>

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

						'attribute'=>'EMP_ID_CARD_PERIOD',

						'model'=>$model,

						// additional javascript options for the date picker plugin

						'options'=>array(

							'mode'=>'focus',

							'showAnim'=>'bounce',

							'flat'=>true,

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

							/*'buttonText'=>yii::t('ui','tentukan tanggal'),

							'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

							'buttonImageOnly'=>true,*/

							'changeMonth'=>true,

							'changeYear'=>true,

							'yearRange'=>'1900:2099',

							'showButtonPanel'=>true,

						),

						'htmlOptions'=>array(

							'style'=>'height:20px; width:100px; text-align:center;',

						),

					));

				?>

			</div>

		</div><!-- end of fifth row-fluid -->

		<div class="row-fluid">

			<div class="span4">

				<?php echo $form->dropDownListRow($model,'EMP_HEALT_TYPE', CHtml::listData(HEALTH::model()->findAll(), 'HI_ID','HI_NAME'),array('prompt'=>'-- Pilih Jaminan Kesehatan --')); ?>

			</div>

			<div class="span4">

				<?php echo $form->textFieldRow($model,'EMP_HI_CARD',array('class'=>'span8')); ?>

			</div>

			<div class="span4">

				<?php echo $form->labelEx($model,'EMP_HI_CARD_PERIOD'); ?>

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

						'attribute'=>'EMP_HI_CARD_PERIOD',

						'model'=>$model,

						// additional javascript options for the date picker plugin

						'options'=>array(

							'mode'=>'focus',

							'showAnim'=>'bounce',

							'flat'=>true,

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

							/*'buttonText'=>yii::t('ui','tentukan tanggal'),

							'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

							'buttonImageOnly'=>true,*/

							'changeMonth'=>true,

							'changeYear'=>true,

							'yearRange'=>'1900:2099',

							'showButtonPanel'=>true,

						),

						'htmlOptions'=>array(

							'style'=>'height:20px; width:100px; text-align:center;',

						),

					));

				?>

			</div>

		</div><!-- end of sixth row-fluid -->

	</div><!-- end of Personal Information form content box -->

</div><!-- end of Personal Information form widget box -->




<!-- INFORMASI TAMBAHAN-->					

<div class="widget-box">

	<div class="widget-title">

		<h5> Informasi Tambahan</h5>

	</div><!-- end of second widget title -->

	<div class="widget-content">		

		<div class="row-fluid">

			<div class="row-fluid">

				<div class="span4">

					<?php echo $form->textFieldRow($model,'EMP_DL_CARD',array('class'=>'span8')); ?>

				</div><!-- end of First span4 -->

				<div class="span4">

					<?php echo $form->labelEx($model,'EMP_DL_CARD_PERIOD'); ?>

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

							'attribute'=>'EMP_DL_CARD_PERIOD',

							'model'=>$model,

							// additional javascript options for the date picker plugin

							'options'=>array(

								'mode'=>'focus',

								'showAnim'=>'bounce',

								'flat'=>true,

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

								/*'buttonText'=>yii::t('ui','tentukan tanggal'),

								'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

								'buttonImageOnly'=>true,*/

								'changeMonth'=>true,

								'changeYear'=>true,

								'yearRange'=>'1900:2099',

								'showButtonPanel'=>true,

							),

							'htmlOptions'=>array(

								'style'=>'height:20px; width:100px; text-align:center;',

							),

						));

					?>

				</div><!-- end of second span4 -->

			</div><!--end off first row-fluid -->

			<div class="row-fluid">

				<div class="span4">

					<?php echo $form->labelEx($model,'EMP_START_CONT'); ?>

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

							'attribute'=>'EMP_START_CONT',

							'model'=>$model,

							// additional javascript options for the date picker plugin

							'options'=>array(

								'mode'=>'focus',

								'showAnim'=>'bounce',

								'flat'=>true,

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

								/*'buttonText'=>yii::t('ui','tentukan tanggal'),

								'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

								'buttonImageOnly'=>true,*/

								'changeMonth'=>true,

								'changeYear'=>true,

								'yearRange'=>'1900:2099',

								'showButtonPanel'=>true,

							),

							'htmlOptions'=>array(

								'style'=>'height:20px; width:100px; text-align:center;',

							),

						));

					?>

				</div><!-- End of first span4 in second row-fluid -->

				<div class="span4">

					<?php echo $form->labelEx($model,'EMP_APP_DATE'); ?>

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

							'attribute'=>'EMP_APP_DATE',

							'model'=>$model,

							// additional javascript options for the date picker plugin

							'options'=>array(

								'mode'=>'focus',

								'showAnim'=>'bounce',

								'flat'=>true,

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

								/*'buttonText'=>yii::t('ui','tentukan tanggal'),

								'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

								'buttonImageOnly'=>true,*/

								'changeMonth'=>true,

								'changeYear'=>true,

								'yearRange'=>'1900:2099',

								'showButtonPanel'=>true,

							),

							'htmlOptions'=>array(

								'style'=>'height:20px; width:100px; text-align:center;',	

							),

						));

					?>

				</div><!-- End of second span4 in second row-fluid -->

				<div class="span3">

					<?php echo $form->labelEx($model,'EMP_END_CONT'); ?>

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

							'attribute'=>'EMP_END_CONT',

							'model'=>$model,

							// additional javascript options for the date picker plugin

							'options'=>array(

								'mode'=>'focus',

								'showAnim'=>'bounce',

								'flat'=>true,

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

								/*'buttonText'=>yii::t('ui','tentukan tanggal'),

								'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.gif',

								'buttonImageOnly'=>true,*/

								'changeMonth'=>true,

								'changeYear'=>true,

								'yearRange'=>'1900:2099',

								'showButtonPanel'=>true,	

							),

							'htmlOptions'=>array(

								'style'=>'height:20px; width:120px; text-align:center;',

							),	

						));

					?>

				</div><!-- End of third span4 in second row-fluid -->

			</div><!-- End of second row-fluid -->

			<div class="row-fluid">

				<div class="span4">

					<?php echo $form->textFieldRow($model,'EMP_PHONE',array('class'=>'span7')); ?>

				</div><!-- End of first span4 in third row-fluid -->

				<div class="span4">

					<?php echo $form->textFieldRow($model,'EMP_CELL',array('class'=>'span7')); ?>

				</div><!-- End of second span4 in third row-fluid -->

				<div class="span4">

					<?php echo $form->textFieldRow($model,'EMP_EMAIL',array('class'=>'span7','maxlength'=>30)); ?>

				</div><!-- End of third span4 in third row-fluid -->

			</div><!-- End of forth row-fluid -->

		</div><!-- End of main row-fluid -->

	</div><!-- End of second widget content -->

</div><!-- End of Informasi tambahan-->




<!-- Informasi Kerja -->

<div class="widget-box">

	<div class="widget-title">

		<h5> Informasi Kerja</h5>

	</div><!-- end of widget-title -->

	<div class="widget-content">		

		<div class="row-fluid">

			<?php echo $form->textAreaRow($model,'EMP_NOTE_REASON',array('class'=>'span7','maxlength'=>500, 'rows'=><img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />); ?>

			<div class="row-fluid">

				<div class="span4">

					<?php echo $form->textFieldRow($model,'EMP_ACCOUNT',array('class'=>'span8')); ?>

				</div><!-- end of second span4 -->

				<div class="span4">

					<?php echo $form->textFieldRow($model,'EMP_TAX',array('class'=>'span5','maxlength'=>30)); ?>

				</div>

			</div>

			<?php echo $form->textAreaRow($model,'EMP_JOB_DESC',array('class'=>'span9','maxlength'=>4000, 'rows'=>10)); ?>

			<div class="row-fluid">

				<div class="span4">

					<?php echo $form->dropDownListRow($model,'EMP_JOB_ID', CHtml::listData(JOB::model()->findAll(), 'JOB_ID','JOB_NAME'),array('prompt'=>'----- Pilih Pekerjaan -----')); ?>

				</div>

				<div class="span8">

					<?php echo $form->fileFieldRow($model,'EMP_PHOTO',array('class'=>'span6','maxlength'=>4000)); ?>

				</div>

			</div>

			<div class="row-fluid">

				<div class="span4">

					<?php echo $form->dropDownListRow($model,'EMP_OFFICE_ID',CHtml::listData(OFFICE::model()->findAll(), 'OFFICE_ID','OFFICE_NAME'), array('prompt'=>'----- Pilih Kantor -----',

						'ajax'=>array(

							'type'=>'POST',

							'url'=>CController::createUrl('filterdepartemen'),

							'update'=>'#EMPLOYEE_EMP_DEPT_ID',

							//'update'=>'#'.CHtml::activeId($model,'CITY_ID'),

							/*'beforSend'=>'function(){

									$("#EMPLOYEE_EMP_CITY_ID").find("option").remove();

								}',*/

							'data'=>array('EMP_OFFICE_ID'=>'js:this.value'),

							)

						)); 

					?>

				</div><!-- end of first span4 in third rowfluid -->	

				<div class="span4">

					<?php echo $form->dropDownListRow($model,'EMP_DEPT_ID', 

						empty($model->EMP_DEPT_ID)? array() :CHtml::listData(DEPARTMENT::model()->findAll('CITY_ID='.$model->EMP_DEPT_ID), 'DEPT_ID', 'DEPT_NAME'),

							array('prompt'=>'----- Pilih Departement -----'

						)); 

					?>

				</div><!-- end of second span4 in third rowfluid -->

				<div class="span3">

					<?php echo $form->dropDownListRow($model,'EMP_STATS',array('prompt'=>'--- Pilih Status Karyawan ---', 'PKWT'=>'PKWT', 'PKWTT'=>'PKWTT', 'Pensiun'=>'Pensiun', 'Resign'=>'Resign')); ?>

				</div><!-- end of span3 -->

			</div><!-- end of third row-fluid -->

		</div><!-- end of main row-fluid -->

	</div><!-- end of widget-content -->

</div><!-- end of windget-box -->



ini _form2.php :




<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(

	'id'=>'schedule-form',

	'enableAjaxValidation'=>false,

)); ?>


	

	<?php echo $form->textFieldRow($model2,'SAL_CURR',array('class'=>'span5','maxlength'=>3)); ?>


	<?php echo $form->textFieldRow($model2,'SAL_PERDAY',array('class'=>'span5','maxlength'=>30)); ?>


	<?php echo $form->textFieldRow($model2,'SAL_TRANS',array('class'=>'span5','maxlength'=>30)); ?>


	<?php echo $form->textFieldRow($model2,'SAL_HEALTH',array('class'=>'span5','maxlength'=>30)); ?>

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




maaf code _form.php panjang :D

kayaknya salahnya ada di nested form, HTML sekarang nggak support nested form, coba baca di sini untuk solusi dengan CJuiTabs

jadi deklarasi form gak boleh begini:




 <form ...>

  <div class="tab-content">

    <div class="tab-pane">

    <form ...>

    element EMP1

    element EMP2...

    </form>

    </div>


    <div class="tab-pane">

    <form ...>

    element SALARY1

    element SALARY2

    </form>

    </div>

  </div>

 </form>



perhatikan, tidak bisa ada banyak form dalam 1 tab, hanya bisa ada 1 form saja, jadi bentuknya perlu diakali jadi gini:




 <form ...>

  <div class="tab-content">

    <div class="tab-pane">

    element EMP1

    element EMP2...

    </div>


    <div class="tab-pane">

    element SALARY1

    element SALARY2

    </div>

  </div>

 </form>



nanti di masing2 view yg partial jangan pake widget form, tapi pake helper CHtml (or TbHtml kalo pake yiistrap) aja, contoh:


        <?php echo $form->textFieldRow($model2,'SAL_CURR',array('class'=>'span5','maxlength'=>3)); ?>

ganti jadi


        <?php echo TbHtml::textFieldRow($model2,'SAL_CURR',array('class'=>'span5','maxlength'=>3)); ?>