cupcake论坛插件中的forum_categories选择框不允许我选择其选项。当我使用鼠标滚动选项时,突出显示位于“选择论坛”。以下是原始
<?php
echo $form->input('forum_category_id', array(
'options' => $forums,
'empty' => '-- '. __d('forum', 'Select a Forum', true) .' --',
'label' => __d('forum', 'Forum Category', true)
));
?>
我将其修改为:
<?php
echo $form->input('Topic.forum_category_id',array(
'empty' => 'Select a Forum',
'options' => $forums
));
?>
以下是它正在生成的html代码:
<select name="data[Topic][forum_category_id]" id="TopicForumCategoryId">
<option value="">Select a Forum</option>
<optgroup label="Summer Camp">
</optgroup>
</select>
forumcategory模型中的find stmt:
$forums = $this->Forum->find('list', array(
'conditions' => array(
'Forum.status' => 0,
'Forum.accessView <=' => $access,
'Forum.access_level_id' => $accessLevels
),
'order' => 'Forum.orderNo ASC'
));
如何摆脱上面的html代码中的optgroup?我只想要一个带选项的简单选择框,而不是像以下那样的选择组:
<select name="data[Topic][forum_category_id]" id="TopicForumCategoryId">
<option value="">Select a Forum</option>
<option value="1">Summer Camp</option>
</select>
谢谢。
答案 0 :(得分:1)
$arr = array(
'optgroup' => array(
'1','2','3'),
'optgroup2' => array(
'1',2,3)
);
echo $this->Form->input('some',array('options' => $arr));
答案 1 :(得分:0)
尝试:
echo $this->Form->input('Topic.forum_category_id', array('options' => $forums, 'empty' => 'Select a Forum'));