2013-03-12 47 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