cakephp select options attributes

夙愿已清 提交于 2019-12-12 13:16:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!