Exemple #1
0
echo $form->dropDownList($model, 'avsan_size', RateMasterForAvasan::items(), array('prompt' => '---Select Size---', 'ajax' => array('type' => 'POST', 'url' => CController::createUrl('Avsan/getItemName'), 'update' => '#Avsan_ausan_total_amount')));
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'avsan_size');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'ausan_total_amount');
?>
		<?php 
if (isset($model->ausan_total_amount)) {
    //echo $form->dropDownList($model,'ausan_total_amount',array());
    echo $form->dropDownList($model, 'ausan_total_amount', CHtml::listData(RateMasterForAvasan::model()->findAll(array('condition' => 'id=' . $model->avsan_size)), 'rate', 'rate'));
} else {
    echo $form->dropDownList($model, 'ausan_total_amount', array());
}
?>
<span class="status">&nbsp;</span>
		<?php 
echo $form->error($model, 'ausan_total_amount');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'discount');
?>
		<?php 
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = RateMasterForAvasan::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actiongetItemName()
 {
     $data = RateMasterForAvasan::model()->findAll('id=:id', array(':id' => (int) $_REQUEST['Avsan']['avsan_size']));
     $data = CHtml::listData($data, 'rate', 'rate');
     foreach ($data as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
 private static function loadItems()
 {
     self::$_items = array();
     $models = self::model()->findAll();
     foreach ($models as $model) {
         // self::$_items[$model->academic_terms_period_id]=$model->academic_terms_period_name."-".$model->academic_term_period;
         self::$_items[$model->id] = $model->color . " " . $model->size;
     }
 }