views:

591

answers:

2

I have a select box that needs to submit it's value to a server side controller on change.

The submit works. The value of the changed element is however not sent.

I've scoured some examples online, but none seem to work

 remote_function(
     :url => some_remote_function_path,
     :with => "'key1='+$('elem_id').value +'&key2='+$('elem_id').value+ '&this_elem_value='+value"
  )

The moment I pass

$('elem_id').value

I simply get that 'statically' as the actual variable passed.

How do I get access to the selected select box value? I'm sure I'm missing something minute her.

Thanks.

A: 
$('elem_id').val()

Kind Regards

--Andy

jAndy
Even here, it seems to not be interpreted:"with"=>"'value='+$('elem_id').val()"is what is passed as a param. Should I wrap this in a script tag? Or am I missing something else?
Forkrul Assail
+1  A: 

You should use jQuery.val() not .value.

Crozin
What does remote_function use by default?Could I have jQuery prototype clashes?
Forkrul Assail
I still get Parameters: {"update_grid_item"=>"0,0", "action"=>"pair", "authenticity_token"=>"AFgY2E7kY2PcPx5XrFWFtYRpcObdQty4THs2et6RyRU=", "id"=>"1", "controller"=>"impact", "_"=>"", "with"=>"'value=' + jQuery.val()"}It seems like it is not interpreted or called but passed statically as text.
Forkrul Assail
Forkrul Assail
the JS is encoded, and therefore the value goes missing or is accessed incorrectly. How should I modify this?
Forkrul Assail
Problem was actually a prototype, jQuery conflict.
Forkrul Assail