Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cakephp select options attributes

i need to set the title attribute of the options in a select like this one:

<select name="webmenu" id="webmenu" onchange="showValue(this.value)">
  <option value="calendar" title="icons/icon_calendar.gif">Calendar</option>
  <option value="shopping_cart" title="icons/icon_cart.gif">Shopping Cart</option>
  <option value="cd" title="icons/icon_cd.gif">CD</option>
  <option value="email"  selected="selected" title="icons/icon_email.gif">Email</option>
  <option value="faq" title="icons/icon_faq.gif">FAQ</option>
  <option value="games" title="icons/icon_games.gif">Games</option>
</select>

i didn't find any help in the cookbook

thanks

like image 873
mirko.cek Avatar asked Aug 28 '26 02:08

mirko.cek


1 Answers

the first tip here might give you an idea on how to use the form helper in a way you want it to: http://www.dereuromark.de/2012/03/01/some-new-crazy-cakephp-tricks/

basically you need to use a deeper array and provide the title and onchange attributes.

like image 86
mark Avatar answered Aug 30 '26 18:08

mark