0

我想在下拉菜单中显示数据。但我的脚本有一些问题。我的脚本可能运行不好。无法显示数据。当这个脚本在执行时,我的下拉列表是空白的

这是我的代码示例:

 <div class="row">
    <?php echo $form->labelEx($model,'freightforwardercountry'); ?>
    <?php echo $form->dropDownList($model,'freightforwardercountry',
    CHtml::listData(TbCountry::model()->findAll(),'countryid','country'),
    array(
    'onchange'=>'$("#TbFreightForwarder_freightforwardercity").html("<option></option>");
    $("#TbFreightForwarder_freightforwarderstate").html("<option></option>");',
    'prompt'=>'',
    'value'=>'',
    'ajax'=>array(
    'type'=>'POST',
    'url'=>CController::createUrl('freightforwarder/liststate'),
    'update'=>'#TbFreightForwarder_freightforwarderstate',
    'data'=>array('countryid'=>'js:this.value'),
    )
    )
    ); ?>

    <?php echo $form->error($model,'freightforwardercountry'); ?>
    </div>

    <div class="row">
    <?php echo $form->labelEx($model,'freightforwarderstate'); ?>
    <?php echo $form->dropDownList($model,'freightforwarderstate',
    $model->listState($model->freightforwardercountry),
    array(
    'prompt'=>'',
    'value'=>'',
    'ajax'=>array(
    'type'=>'POST',
    'url'=>CController::createUrl('freightForwarder/listcity'),
    'update'=>'#TbFreightForwarder_freightforwardercity',
    'data'=>array('stateid'=>'js:this.value'),
    )
    )
    ); ?>
    <?php echo $form->error($model,'freightforwarderstate'); ?>
    </div>

    <div class="row">
    <?php echo $form->labelEx($model,'freightforwardercity'); ?>
    <?php echo $form->dropDownList($model,'freightforwardercity',$model->listCity($model->freightforwarderstate),array('prompt'=>'','value'=>'')); ?>
    <?php echo $form->error($model,'freightforwardercity'); ?>
    </div>
4

0 回答 0