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