Overwrite_params

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

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 )})

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” [email protected]