0
所以基本上我有2个不同的下拉列表,例如A有10个选项,B有10个选项。Yii将2个下拉列表合并为1
我怎样才能让他们在1单下拉?例如,A的前10个选项和B的前10个?
下面是下拉答:
<?php echo $form->labelEx($model,'clientPackagedService_id'); ?>
<?php $client = Client::model()->findByPk(1);?>
<?php echo $form->dropDownList($model, 'clientPackagedService_id', CHtml::listData($client->clientPackagedservices(array('condition'=>'client_id='.$client->id.' AND booking_id IS NULL')),'id','packagedServiceInfo'),
array('disabled'=>'disabled', 'prompt'=>'Select Packaged Service...')
); ?>
<?php echo $form->error($model,'clientPackagedService_id'); ?>
下面是下拉B:
<?php echo $form->labelEx($model,'service_id'); ?>
<?php echo $form->dropDownList($model, 'service_id', GxHtml::listDataEx(Service::model()->findAllAttributes(null, true)),
//array('prompt'=>'Select Service...')
array(//
//'disabled'=>$disabledValue, //
'enabled'=>true,
'prompt' => 'Select service...',
'ajax' => array('type'=>'POST', //request type
'url'=>CController::createUrl('updateMasseuseAndStationListSID'), //url to call.
'data'=>array('service_id'=>'js:this.value', 'dt'=>'js:$("#Booking_date").val()', 'timeStart'=>'js:$("#Booking_timeStart").val()'),
'dataType'=>'json',
'success'=>'js:function(data) {
//alert(data.masseuse);
var mass="#'.CHtml::activeId($model, 'masseuse_id').'";
$(mass).html(data.masseuse);
$(mass).trigger("chosen:updated");
$(mass+"_chzn").css("width","300px");
$(mass+"_chzn > .chzn-drop").css("width","298px");
var station="#'.CHtml::activeId($model, 'station_id').'";
$(station).html(data.station);
$(station).trigger("chosen:updated");
$(station+"_chzn").css("width","300px");
$(station+"_chzn > .chzn-drop").css("width","298px");
//alert(data.timeEnd);
var timeEnd="#'.CHtml::activeId($model, 'timeEnd').'";
$(timeEnd).val(data.timeEnd);
}',
)
)); ?>
<?php echo $form->error($model,'service_id'); ?>
我如何加入他们两个,然后保持阿贾克斯同样的操作?
请指教。提前致谢。
你碰巧有,我可以有一个参考的例子吗?我知道你在说什么,只是我从来没有做过。 – NewbieCoder 2015-04-06 00:50:13