CakePHP: 设置下拉列表默认值和单选框默认值

来源:互联网 发布:浪漫表白c语言程序 编辑:程序博客网 时间:2024/06/05 09:34

使用default属性来设置单选框(type = radio)的默认值:

                    echo $form->input('Deal.type', array(

                        'type' => 'radio',
                        'div' => array('class' => 'radio'),
                        'options' => array(
                            '0' => 0,
                            '3' => 3,
                            '10' => 10,
                        ),
                        'default' => 0,

                    ));


使用selected属性设置下拉列表(type = select)的默认值:

                        echo $form->input('Deal.branch_id', array( 'type' => 'select',
                            'multiple' => true,
                            'options' => array(1,2,3),
                            'selected' =>  '1',
                        ));


iefreer