0

I want to display data in a dropdown menu. but I have some problems with my script. My script may not run good. data can not be displayed. my dropdown are blankout when this script in execution

This is sample my code:

 <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