?> <?php echo CHtml::textField('OENO', $search['OENO'], array('class' => 'width150 input', 'fuc' => 's')); ?> <label style="margin-left:30px;"> 配件品类:</label> <?php $cpnames = GoodsStandard::model()->findAll(); $cpname = CHtml::listData($cpnames, "system_type", "system_type"); $cpname = array_filter($cpname); echo CHtml::dropDownList('system_type', $search['system_type'], $cpname, array('class' => 'width118 select', 'empty' => '选择系统类别', 'ajax' => array('type' => 'GET', 'url' => Yii::app()->request->baseUrl . '/common/getcp_name', 'update' => '#cp_name', 'data' => 'js:"system_type="+jQuery(this).val()'))); ?> <?php if ($_GET['system_type']) { $datas = GoodsStandard::model()->findAll("system_type=:system_type", array(":system_type" => $_GET['system_type'])); $data = CHtml::listData($datas, "cp_name", "cp_name"); } $data_update = $_GET['system_type'] ? $data : array(); ?> <?php echo Chtml::dropDownList('cp_name', $search['cp_name'], $data_update, array('class' => 'width118 select', 'empty' => '主营品类')); ?> <?php // echo CHtml::textField('normName',$search['normName'],array('class'=>'width63 input')); ?> </p> <p class="form-row" style="padding-bottom: 10px;"> <!--<label class="label">所在地区: </label>
/** * 获取系统类别 */ private function getsystem($cpname) { $system = GoodsStandard::model()->find("cp_name like '%{$cpname}%'"); return $system['system_type']; }
$form = $this->beginWidget('CActiveForm', array('id' => 'templatemodify-form', 'enableAjaxValidation' => true, 'enableClientValidation' => true, 'clientOptions' => array('validateOnSubmit' => true))); ?> <div class="form"> <div class="row" style="margin-left: 50px"> <label class="label">模板名称:</label> <?php echo $form->textField($model, 'name', array('class' => 'width113 input', 'value' => $result['name'])); ?> <!-- <input type="text" class="width453 input" style="width: 453px;"> --> <!-- <span class="color-red">*</span> --> <span style="padding-left:20px;">配件品类</span> <?php echo $form->dropDownList($model, 'system_type', CHtml::listData($parts, 'system_type', 'system_type'), array('class' => 'widht100 input', 'empty' => '请选择系统', 'ajax' => array('type' => 'GET', 'url' => Yii::app()->request->baseUrl . '/common/getcpnames', 'update' => '#GoodsTemplate_cpname', 'data' => 'js:"system_type="+jQuery(this).val()'))); ?> <?php $data = GoodsStandard::model()->findAll("system_type=:system_type", array(":system_type" => $model->system_type)); ?> <?php echo $form->dropDownList($model, 'cpname', CHtml::listData($data, 'id', 'cp_name'), array('class' => 'width115 select', 'empty' => '请选择品类')); ?> <?php echo $form->error($model, 'name'); ?> <?php echo $form->error($model, 'cpname'); ?> </div> </div> <div class='input-list'> <table cellspacing=0 cellpadding=0>
public function actionGetcpname() { if (!empty($_GET['system_type'])) { $data = GoodsStandard::model()->findAll("system_type=:system_type", array(":system_type" => $_GET['system_type'])); $data = CHtml::listData($data, "id", "cp_name"); foreach ($data as $value => $name) { echo CHtml::tag("option", array("value" => $value), CHtml::encode($name), true); } } else { echo CHtml::tag("option", array("value" => ''), '请选择品类', true); } }
<?php echo $form->labelEx($model, '商品品牌:', array('class' => 'label')); ?> <?php echo $form->textField($model, 'goodsBrand', array('size' => 24, 'maxlength' => 24, 'class' => 'width213 input')); ?> <?php echo $form->error($model, 'goodsBrand'); ?> </p> <p class="form-row"> <?php echo $form->labelEx($model, '配件品类:', array('class' => 'label')); ?> <?php $cpnames = GoodsStandard::model()->findAll(); $cpname = CHtml::listData($cpnames, "system_type", "system_type"); $cpname = array_filter($cpname); echo CHtml::dropDownList('system_type', 'system_type', $cpname, array('class' => 'width118 select', 'empty' => '选择系统', 'ajax' => array('type' => 'GET', 'url' => Yii::app()->request->baseUrl . '/common/getcp_name', 'update' => '#cp_name', 'data' => 'js:"system_type="+jQuery(this).val()'))); ?> <?php echo Chtml::dropDownList('cp_name', 'cp_name', array(), array('class' => 'width118 select', 'empty' => '请选择品类')); ?> <span id='addcpname' class="btn" style="cursor:pointer">添加</span> <?php // echo $form->textField($model,'normName',array('size'=>24,'maxlength'=>24,'class'=>'width213 input')); ?> <?php //echo $form->error($model,'normName');