Hello all I have very strange issue with my code. i have a select tag, onchange it is calling a function. but i want to pass selected value from drop down in that function. But that function is already performing few actions, so I have to use overwrite_params. please look at following code: select_tag(''srtType'', options_for_select([''Sort By'', ''Price'', ''Title'', ''date'']), { :onchange => remote_function( :url=> { :controller => ''listings'', :action => :search_results, :overwrite_params => { :srtType => "this.value"] }} , :method => "''post''" ) } ) overwrite_params => { :srtType => "this.value"] } is not passing selected value. it is passing it as string. Please advice. Ajit --~--~---------~--~----~------------~-------~--~----~ 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, you should use use "with" parameter to send javascript values. Here is the how to do it : select_tag(''srtType'', options_for_select([''Sort By'', ''Price'', ''Title'', ''date'']), {:onchange => remote_function( :url=> { :controller => ''listings'', :action => :search_results}, :with => "{srtType:this.value}", :method => :post )}) On Nov 25, 6:05 pm, Ajit <ajitscor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello all > > I have very strange issue with my code. > > i have a select tag, onchange it is calling a function. but i want to > pass selected value from drop down in that function. But that function > is already performing few actions, so I have to use overwrite_params. > please look at following code: > > select_tag(''srtType'', options_for_select([''Sort By'', ''Price'', ''Title'', > ''date'']), > { > :onchange => remote_function( > :url=> { :controller => ''listings'', :action > => :search_results, :overwrite_params => { :srtType => > "this.value"] }} , > > :method => "''post''" ) > } > ) > > overwrite_params => { :srtType => "this.value"] } is not passing > selected value. it is passing it as string. > > Please advice. > > Ajit--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hello unfortunately i am unable to do so, because there are some parameters in search_results which i want to keep and overwrite one particular. Ajit On Nov 25, 1:06 pm, "Jean-Sébastien" <jeansebastien....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> hi, you should use use "with" parameter to send javascript values. > > Here is the how to do it : > > select_tag(''srtType'', > options_for_select([''Sort By'', ''Price'', ''Title'', ''date'']), > {:onchange => remote_function( > :url=> { > :controller => ''listings'', :action > => :search_results}, :with => "{srtType:this.value}", :method > => :post )}) > > On Nov 25, 6:05 pm, Ajit <ajitscor...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hello all > > > I have very strange issue with my code. > > > i have a select tag, onchange it is calling a function. but i want to > > pass selected value from drop down in that function. But that function > > is already performing few actions, so I have to use overwrite_params. > > please look at following code: > > > select_tag(''srtType'', options_for_select([''Sort By'', ''Price'', ''Title'', > > ''date'']), > > { > > :onchange => remote_function( > > :url=> { :controller => ''listings'', :action > > => :search_results, :overwrite_params => { :srtType => > > "this.value"] }} , > > > :method => "''post''" ) > > } > > ) > > > overwrite_params => { :srtType => "this.value"] } is not passing > > selected value. it is passing it as string. > > > Please advice. > > > Ajit--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---