2011-06-16 64 views
0

如何在select_tag中使用link_to?像这样...如何在select_tag中使用link_to?

<%= select_tag "test1","<option>#{link_to 'View Details', view_path(test)}</option><option>#{link_to 'Delete', delete_path(test)}</option><option>#{link_to 'Edit Details', edit_path(test)}</option>"%> 

任何解决方案?

+0

你为什么要这么做?基本的html:链接不起作用里面的下拉框花花公子:) – dexter 2011-06-16 06:27:50

回答

4
<%= select_tag "test1","<option value='#{view_path(test)}'>View Details</option><option value='#{delete_path(test)}'>Delete</option><option value='#{edit_path(test)}'>Edit Details</option>" ,:onchange => "window.open(this.options[this.selectedIndex].value,'_top')" %> 
+0

你的问题应该更具描述性 – gertas 2011-06-16 08:37:53

相关问题