2013-03-12 43 views
4

问题在选择框(Cakephp 1.3)中显示标题或范围?

在固定宽度的选择框中显示鼠标悬停的冗长选项。

名称被隐藏在这里:
Names hidden here

渲染HTML浏览器

<select id="prim" size="5" multiple="multiple" scroabble="1" name="prim[]"> 
<option value="Applied Research Associates Inc.">Applied Research Associates Inc.</option> 
</select> 

所需的输出

显示spantitle如下

enter image description here

预期的HTML

<select id="prim" size="5" multiple="multiple" scroabble="1" name="prim[]"> 
<option value="Applied Research Associates Inc." title="Applied Research Associates Inc.">Applied Research Associates Inc.</option> 
</select> 

我的CakePHP代码

echo $form->input('prim', 
         array('options'=>$refined_list, 
          'type'=>'select', 
          'scrollable'=>true, 
          'multiple'=>true, 
          'name'=>'prim', 
          'label'=>false, 
          'size'=>'5')); 

我要补充什么属性根据需要进行修改?

编辑/ UPDATE:一种方式是通过@ammu的建议与title场更新我$refined_list阵列。我必须等待更好的解决方案。

回答

0

那么这样使用它,你会得到你想要的东西:

$options = array(
    ... 
    array('name' => 'United states', 'value' => 'USA', 'title' => 'the title that you want'), 
    array('name' => 'USA', 'value' => 'USA', 'title' => 'the other title that you want'), 
); 

echo $this->Form->input('test', array('type'=>'select', 'options'=>$options)); 

您还可以在阵列中每个选项的形式添加任何你想要的属性(类,占位符等)。

+0

您能否详细说明一下...... – Deadlock 2013-03-12 20:23:31

+0

已编辑,这里是您的答案。 – Amir 2013-03-13 05:00:22

+0

'$ refined_list'数组是由'cakephp'' find('list')'方法生成的,所以我必须在生成后再次编辑我的数组... – Deadlock 2013-03-13 05:06:41