【问题标题】:Yii DropdownList promptYii 下拉列表提示
【发布时间】:2014-02-06 08:30:46
【问题描述】:

我有这个下拉列表,但是它没有以prompt或empty作为默认值,它总是取$list的最后一个值,为什么会这样?

        $models = ZfInfraestructuras::model()->findAll(array('order' => 'infraestructura_nombre'));
        $list = CHtml::listData($models, 
                'infraestructura_id', 'infraestructura_nombre');

        echo CHtml::dropDownList('infraestructuras', $models, 
              $list,
              array('prompt' => 'Selecciona Infraestructura'));
    ?>
</div>

【问题讨论】:

    标签: php yii frameworks


    【解决方案1】:
    public static string dropDownList(string $name, string $select, array $data, array $htmlOptions=array ( ))
    

    检查选择参数

    http://yiiapi.com/CHtml#dropDownList-detail

    【讨论】:

    • 谢谢!你让我找到了解决方案:D
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多