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 -- Posted via http://www.ruby-forum.com/.
Maybe "with" section should look like with => ''id=''+value? I think in your variant you assign to id a string value ''value''. Regards, Bob On 25 май, 09:16, Devi Rv <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 > -- > Posted viahttp://www.ruby-forum.com/.
Julian Leviston
2009-May-25 06:34 UTC
Re: onChange => remote_function - Not able to get current id
On 25/05/2009, at 3:16 PM, Devi Rv wrote:> > 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. > >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/