我是ruby的新手并试图在这里调用js函数onchange但是没有工作而没有得到合适的答案。
= f.select :amendment_type, [['Renewal','renewal'],['Lease Amendment Agreement','Lease Amendment Agreement'],['Expansion','Expansion'],['Storage','Storage'],['Parking','Parking'],['Other(for me to fill in)','Other']], class: "amendment_type input", style: "width: 450px;", onchange: "alert('hello')"
答案 0 :(得分:1)
select
方法参数为:
select(method,choices = nil,options = {},html_options = {},& block)
您已针对options
使用html_options
,因此您必须将代码替换为:
= f.select :amendment_type, [['Renewal','renewal'],['Lease Amendment Agreement','Lease Amendment Agreement'],['Expansion','Expansion'],['Storage','Storage'],['Parking','Parking'],['Other(for me to fill in)','Other']], {}, class: "amendment_type input", style: "width: 450px;", onchange: "alert('hello')"