【发布时间】:2011-02-18 02:01:57
【问题描述】:
当我在 date_select 上使用 AJAX 时,仅将值作为参数传递给已更改的值 但我也需要每个字段的值。
例子
日期选择
2011 年 6 月 5 日 => 更改为 2011 年 6 月 6 日,但 AJAX VALUE 仅在参数中传递值“6”。
我需要日期、月份和年份。
我的代码 风景 submit_cancellation_admin_operation_path) 做 |f| %>
<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
谢谢
【问题讨论】:
-
请问我需要如何解决这个问题
标签: ruby-on-rails