Show title or space in selection box (Cakephp 1.3)?

Problem

Show long options when hovering over a fixed width selection box.

Names are hidden here:
Names hidden here

Highlighted HTML in the browser

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

Required conclusion

Show span or title as below

enter image description here

Expected 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> 

My CakePHP Code

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

What attribute should be added to make the desired changes?

EDIT / UPDATE: One way might be to update the $refined_list with the title field, as suggested by @ammu. I have to wait for a better solution.

+4
source share
2 answers

There is no way to add an attribute to select an option in the cakephp documentation. Look at this, it can help you add attributes to select an option.

http://www.dereuromark.de/2012/03/01/some-new-crazy-cakephp-tricks/

+2
source

Make good use of it like this and you will get what you want:

 $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)); 

You can also add any attribute you want in the form of an array for each parameter (class, placeholder, etc.).

0
source

All Articles