Forum: Ruby on Rails onChange => remote_function - Not able to get current id

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
57f355c4d8bab93d67dfbd1691ab0be4?d=identicon&s=25 Devi Rv (devirv)
on 2009-05-25 07:16
Hi,

Below is the code I am using to display drop down. This drop down is for
displaying categories.

<% form_for :category do |form| %>
  <%= form.collection_select(:id,@categories, :id,
    :category_name, {},
    {:onChange => remote_function(:url=>{:action=>'say_hello',
        :with => "'id='+value"},
        :update=>'mydiv')}
       )  %>
<% end %>

I want to get the 'current category id' during onchange. Using :with =>
"'id='+value" I am not able to get it.


Plaese anyone suggest
Faa7668cbfccc3beb7d6babb53abb316?d=identicon&s=25 Bob (Guest)
on 2009-05-25 08:08
(Received via mailing list)
Maybe "with" section should look like with => 'id='+value? I think in
your variant you assign to id a string value 'value'.

Regards,
Bob
3131fcea0a711e5ad89c8d49cc9253b4?d=identicon&s=25 Julian Leviston (Guest)
on 2009-05-25 08:35
(Received via mailing list)
On 25/05/2009, at 3:16 PM, Devi Rv wrote:

>    {:onChange => remote_function(:url=>{:action=>'say_hello',
>        :with => "'id='+value"},
>        :update=>'mydiv')}
>       )  %>
> <% end %>
>
> I want to get the 'current category id' during onchange. Using :with
> =>
> "'id='+value" I am not able to get it.
>
>


For a start, you have :with as part of the :url hash... it should be
on the same level as :update.

Julian.

----------------------------------------------
Blog: http://random8.zenunit.com/
Twitter: http://twitter.com/random8r
Learn: http://sensei.zenunit.com/
Latest: How to use Unix basics at http://sensei.zenunit.com/
This topic is locked and can not be replied to.