2011-06-16 62 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

相關問題