语法错误,意外')',期待kEND

时间:2014-08-21 12:01:22

标签: ruby-on-rails ruby-on-rails-3

我收到语法错误消息

<%= 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')"  )}" }%>

1 个答案:

答案 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>