我收到语法错误消息
<%= calendar_date_select_tag 'e_date', I18n.l( Date.today , :format=>:default),:year_range => 15.years.ago..5.years.from_now, :readonly=>true, :popup=>"force",
{:onchange => "#{remote_function(
:url => { :action => 'report_new' },
:with => "'start_date='+s_date+'end_date='+e_date+'&batch_id='+#{@batch.id}",
:before => "Element.show('loader')",
:success => "Element.hide('loader')" )}" }%>
答案 0 :(得分:1)
试试这个......
:onchange => remote_function(:url => {:controller => 'controller', :action => 'action'})
或
不要将你的视图/ html与javascript混合(忘记阻碍javascript) 相反,还有一种更清洁的方式......
<%= select_tag :variable, options_from_collection_for_select(:all, :id, :name), :onchange => 'your_onchange_handler()' %>
<script type='text/javascript'>
$(document).ready(function(){
function your_onchange_handler(){
//do what u want to do when select changes
}
})//document ready ends
</script>