Ajit Singh wrote:
can you post your code?
On Jun 20, 3:03 am, Sneha Ganvir <rails-mailing-l...@andreas-s.net
The code for the partial used in this attachment is
for vendor list is
<%= error_messages_for 'contract' %>
<%=
vendors =
@contracts_vendor.each do |contract|
vendors << contract.vendor
end
select_tag "vendor",
options_for_select(
vendors,
session[:selected_vendor] ),
{:onchange=> link ,
:id=>"ctrlContent_ct200_VendorList",
:name=>"ctrlContent$ct200$VendorList",
}
%>
and the partial for selecting the date is as
<%=
d = Date.today
dates =
15.times do
dates << [d.strftime("%B %Y"), d.strftime("%Y%m")]
d = d << 1
end
select_tag "month",
options_for_select(
dates,
session[:selected_month] ),
{:onchange=> link ,
:id=>"ctrlContent_ctl00_MonthList",
:name=>"ctrlContent$ctl00$MonthList"}
%>
The controller code is for vendor
def set_selected_vendor
if params[:vendor]
session[:selected_vendor] = params[:vendor]
@array_vendor = session[:selected_vendor]
#redirect_to :action=>action_name
#return false
end
return true
end
and controller code for date is
def set_selected_month
if params[:month]
session[:selected_month] = params[:month]
# redirect back here without the month parameter:
redirect_to :action=>action_name
return false
end
unless session[:selected_month]
@month_start = Date.new(Date.today.year, Date.today.month, 1)
@month_end = @month_start>>1
# If it's early in the month (i.e. before the 11th), use last
month as the default:
if Date.today.day < 11 then @month_start = @month_start<<1 end
session[:selected_month] = @month_start.strftime('%Y%m')
end
@month_start = Date.parse session[:selected_month] + "01"
@month_constraints_string = "date >= '" + @month_start.to_s +
"' AND date < '" + (@month_start>>1).to_s + "'"
return true
end
Please help me out of this.
Attachments:
http://www.ruby-forum.com/attachment/2230/search_by_customer.rhtml