Pass selected option to remote_function with Ruby on Rails

Posted by mathee on Stack Overflow See other posts from Stack Overflow or by mathee
Published on 2010-05-27T03:48:56Z Indexed on 2010/05/27 3:51 UTC
Read the original article Hit count: 394

Filed under:
|
|

I have a list of options generated by the following Haml code.

  %select#tags{:onchange => remote_function(:url => {:action => :display_tag_cart}, :with  => 'Form.Element.serialize(this)'), :prompt => 'Choose a Tag'}
    %option{:value=>""}
      Choose a Tag
    -Tag::TAGS.each do |t|
      %option{:value=>t.id}
        =h t.name

Form.Element.serialize(this) does not work.

How do I pass the value of the selection to display_tag_cart?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about AJAX