Hi, In my web application i need to select date and and vendor to display the corresponding data When i select the date, it doesn''t get displayed in the url i.e the url remains the same but when i select the vendor it appears in the url. I want that even the vendor shouldn''t get appeared in the url Please help.... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, In my web application i need to select date and and vendor to display the corresponding data When i select the date, it doesn''t get displayed in the url i.e the url remains the same but when i select the vendor it appears in the url. I want that even the vendor shouldn''t get appeared in the url Please help.... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
can you post your code? On Jun 20, 3:03 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi, > In my web application i need to select date and and vendor to display > the corresponding data > When i select the date, it doesn''t get displayed in the url i.e the url > remains the same > but when i select the vendor it appears in the url. > > I want that even the vendor shouldn''t get appeared in the url > > Please help.... > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ajit Singh wrote:> can you post your code? > > > > On Jun 20, 3:03 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.orgThe 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
are you submitting the form ;onchange, ? if yes then i will suggest you to check post method for both date and vendor. it should be "post" not "get". if you havent specified any.. i will recommend to explicitly put form method="post" let me know, if this works for you. Ajit On Jun 20, 9:33 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ajit Singh wrote: > > can you post your code? > > > On Jun 20, 3:03 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > 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 > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yes i have already tried using method = "post" ( in controller,views and partials) But iam not sure whether i''ve used it correctly or not Please can you guide me where exactly i should use it On Jun 20, 7:39 pm, Ajit <ajitscor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> are you submitting the form ;onchange, ? > > if yes then i will suggest you to check post method for both date and > vendor. it should be "post" not "get". if you havent specified any.. i > will recommend to explicitly put form method="post" > > let me know, if this works for you. > > Ajit > > On Jun 20, 9:33 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > Ajit Singh wrote: > > > can you post your code? > > > > On Jun 20, 3:03 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > > 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 > > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
view source for your form in web-browser and post me the source for form part. if possible? Ajit On Jun 20, 11:20 am, sneha <snehagan...-/E1597aS9LQxFYw1CcD5bw@public.gmane.org> wrote:> Yes i have already tried using method = "post" ( in controller,views > and partials) > But iam not sure whether i''ve used it correctly or not > Please can you guide me where exactly i should use it > > On Jun 20, 7:39 pm, Ajit <ajitscor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > are you submitting the form ;onchange, ? > > > if yes then i will suggest you to check post method for both date and > > vendor. it should be "post" not "get". if you havent specified any.. i > > will recommend to explicitly put form method="post" > > > let me know, if this works for you. > > > Ajit > > > On Jun 20, 9:33 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > wrote: > > > > Ajit Singh wrote: > > > > can you post your code? > > > > > On Jun 20, 3:03 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org > > > > 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 > > > > -- > > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ajit Singh wrote:> view source for your form in web-browser and post me the source for > form part. if possible? > > AjitI''ve send you the view source of my browser.. Attachments: http://www.ruby-forum.com/attachment/2234/search_by_vendor_2_.txt -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Sneha I just tested your document.. in both of the cases.. url is getting updated. cant you simple create a form around those two elements and onchange submit the form try something like: <javascript> function doSomething() { form1.element1.value = $F(''select_one''); form1.element2.valie = $F(''select_two''); form1.submit; } </javascript> <% form :id=>form1, :method => ''post'' %> <% hidden_field :id=>element1%> <% hidden-field :id => element2 %> <select_tag :id => select_one :onchange => doSomething()><%end%> <select_tag :onchange => doSomething()> <% end %> let me know... Ajit On Jun 21, 5:53 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ajit Singh wrote: > > view source for your form in web-browser and post me the source for > > form part. if possible? > > > Ajit > > I''ve send you the view source of my browser.. > > Attachments:http://www.ruby-forum.com/attachment/2234/search_by_vendor_2_.txt > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ajit Singh wrote:> Hi Sneha > > I just tested your document.. in both of the cases.. url is getting > updated. > > cant you simple create a form around those two elements and onchange > submit the form > > try something like: > <javascript> > function doSomething() > { > form1.element1.value = $F(''select_one''); > form1.element2.valie = $F(''select_two''); > form1.submit; > } > </javascript> > <% form :id=>form1, :method => ''post'' %> > <% hidden_field :id=>element1%> > <% hidden-field :id => element2 %> > <select_tag :id => select_one :onchange => doSomething()><%end%> > <select_tag :onchange => doSomething()> > <% end %> > > > let me know... > > Ajit > > On Jun 21, 5:53 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Hi Ajit That''s what my actual problem is I do not want to use the submit tag The values should get changed onclick I cannot use the seperate submit tag to submit the values Because my client demands that. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
hmmm.. i dont think that it could be done otherwise. you can explain this to client.. there are only two methods to send information.. GET and POST. explain the difference between these two. or you can try making an Ajax call. let me know On Jun 24, 6:22 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Ajit Singh wrote: > > Hi Sneha > > > I just tested your document.. in both of the cases.. url is getting > > updated. > > > cant you simple create a form around those two elements and onchange > > submit the form > > > try something like: > > <javascript> > > function doSomething() > > { > > form1.element1.value = $F(''select_one''); > > form1.element2.valie = $F(''select_two''); > > form1.submit; > > } > > </javascript> > > <% form :id=>form1, :method => ''post'' %> > > <% hidden_field :id=>element1%> > > <% hidden-field :id => element2 %> > > <select_tag :id => select_one :onchange => doSomething()><%end%> > > <select_tag :onchange => doSomething()> > > <% end %> > > > let me know... > > > Ajit > > > On Jun 21, 5:53 am, Sneha Ganvir <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > Hi Ajit > That''s what my actual problem is > I do not want to use the submit tag > The values should get changed onclick > I cannot use the seperate submit tag to submit the values > Because my client demands that. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---