2011-01-05 8 views
0

date_selectでAJAXを使用すると、パラメータとして渡された値はパラメータとして変更された値 になりますが、各フィールドの値も必要です。Ajaxの問題日付選択の変更値

DATESELECT

2011年6月5日=> 2011年6月6日に変更しなくAJAX値だけ値 "6" PARAMSに渡します。

日、月、年が必要です。

私のコード のform_forビュー <%(@operation、:URL => submit_cancellation_admin_operation_path)やる| | 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 

おかげで、私はこの問題を解決するためのjQueryを使用し

+0

すみませんが、AHAXはAJAX – maxiperez

+0

私はこの問題を解決する方法を解決する必要があります – maxiperez

答えて

0

を。あなたの提案を聞く(または読む)最善の解決策(私はこのフレーズのためにGoogle翻訳を使用します)。

<%= date_select("", :payment_date, {:start_date => Time.now - 10}, {:onchange =>"#{remote_function(:url => {:controller => 'operations', :action => "update_payment_date", :id=> @operation.id}, 
           :with => "'payment_date_1i='+$j('#_payment_date_1i').val()+'&payment_date_2i='+$j('#_payment_date_2i').val()+'&payment_date_3i='+$j('#_payment_date_3i').val()")}"}) %> 
関連する問題