如何使用 bootstrap-UI 设置选择和单选框值



你好,我是 Cakephp3 的 biginner ,我想使用 bootstrap-UI 来设置我的选择和单选框值,如 Cakephp formhelper。

<?= $this->Form->select(
                        'field',
                        ['Low (7%)', 'middle(15%)', 'Quality (25%)', 'High (30%)'],['label'=>'Error Correction','class'=>'form-control']
                    ); ?>
                    <br/>

                    <?= $this->Form->radio(
                        'Image Format',
                        [
                            ['value' => 'png', 'text' => 'png', 'class'=>'radio-inline'],
                            ['value' => 'gif', 'text' => 'gif'],
                            ['value' => 'jpeg', 'text' => 'jpeg'],
                            ['value' => 'svg', 'text' => 'svg'],
                            ['value' => 'eps', 'text' => 'eps'],
                        ], ['checked' => 'true','label'=>'Image Format','class'=>'radio-inline']
                    ); ?>

谁能帮我,提前感谢

上面的示例有效,但我无法添加选项,因为我使用 bootstrap-ui 所以 我必须使用控制而不是像这样选择或无线电:

<?= $this->Form->control('ecc', ['type' => 'select', 'label' => 'Error Correction', 'class' => 'form-control'
                        , 'options' => [['value' => 'Low (7%)', 'text' => 'Low (7%)'], ['value' => 'middle(15%)', 'text' => 'middle(15%)'], ['value' => 'Quality (25%)', 'text' => 'Quality (25%)'], ['value' => 'High (30%)', 'text' => 'High (30%)']]]); ?>

                    <br/>
                        <?= $this->Form->control(
                            'Format', ['type' => 'radio', 'checked' => 'true', 'label' => 'Image Format', 'class' => 'radio-inline',
                                'options' => [
                                    ['value' => 'png', 'text' => 'png'],
                                    ['value' => 'gif', 'text' => 'gif'],
                                    ['value' => 'jpeg', 'text' => 'jpeg'],
                                    ['value' => 'svg', 'text' => 'svg'],
                                    ['value' => 'eps', 'text' => 'eps'],
                                ]]
                        ); ?>

最新更新