dapeng 2012-10-09 09:25:54 3400次浏览 3条回复 0 0 0
<div class="row" id="choosen" <?php if($model->object_statue==1 || $model->object_statue==''){ ?>style="display:none"<?php } ?>>
    <?php echo $form->labelEx($model,'choosen'); ?>
    </br>
    <?php $department_array=Department::model()->findAll("id>:id",array(":id"=>'1'));		  
    foreach($department_array as $item){ //部门循环开始
        echo "<a href='#' onclick='shownames(\"choosen_dept_".$item['id']."\")'>".$item['name']."</a>";
        echo "</br>";
    ?>
    <div style="display:none" id="choosen_dept_<?php echo $item['id'] ?>">
    <?php 
        echo $form->checkBoxList($model,'choosen[]',CHtml::listData(Staff::model()->findAllBySql("select id,name from oa_staff where dept_id>:dept_id and dept_id=:dept_value and job_status!=3",array(':dept_id'=>'1',':dept_value'=>$item['id'])),'id','name'), array('separator'=>'&nbsp;&nbsp;&nbsp;' , 'labelOptions'=>array('style'=>'display:inline;')));  
        echo "</br>";

    ?>
</div>
    <?php 
    } //部门循环结束

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

foreach里面的参数 choosen只有加上[]受 控制器才能接受值 r然而修改的时候 只能接受$mdoel->choosen的值

您需要登录后才可以回复。登录 | 立即注册