问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/10044445/cakephp-select-options-attributes