0
當我在date_select上使用AJAX時,該值僅作爲參數傳遞給已更改的值 ,但我也需要每個字段的值。Ajax日期選擇onchange值的問題
例
DATESELECT
2011年6月5日=>更改至6 2011年6月,但AJAX VALUE僅通過在PARAMS的值 「6」。
我需要日,月和年。
我的代碼 The View <%form_for(@operation,:url => submit_cancellation_admin_operation_path)do | f | %> <%= f.error_messages%>
<p>Fecha de Pago:<br/><br/>
<%= date_select("", :payment_date, {:start_date => Time.now - 10}, {:onchange =>"#{remote_function(:url => {:controller => 'operations', :action => "update_payment_date"}, :with => "'payment_date='+value")}"}) %>
</p>
<% end %>
的控制器
def cancel
@operation = Operation.find(params[:id])
last_pagare = Pagare.find(:first, :conditions => "operation_id = #{@operation.id} AND state <> 'cancelled'")
#The condition unless is because the last_pagare could be nil if the operation is totally cancelled
@punitive_ammount = @operation.get_punitive(DateTime.now.to_date, last_pagare.expiration_date.to_date) unless last_pagare.nil?
end
def update_payment_date
#Here I take the params
end
由於
對不起AHAX是AJAX – maxiperez 2011-01-05 13:58:37
請問我需要解決如何解決這個問題 – maxiperez 2011-01-07 15:11:17