hello list
I have this check_box in my code
<% for mercado in @merca %>
<%= check_box "mercado", "nombre", {:value=>mercado.id,
:name=>mercado.nombre},
:onchange => remote_function(:url => {:action => "find2"}, :with
=> "'id=#{mercado.id}'") %> <%=mercado.nombre%><br />
<% end %>
but nothing happen when I click, no call to find2
any idea
thanks
on 19.08.2008 21:11
on 19.08.2008 21:15
On 19 Aug 2008, at 20:11, Leonard Yera wrote: > <% end %> > > but nothing happen when I click, no call to find2 the onchange should be part of the same options has as :value and :name Fred
on 19.08.2008 22:21
Hi Leonard, Leonard Yera wrote: > <% for mercado in @merca %> > <%= check_box "mercado", "nombre", {:value=>mercado.id, > :name=>mercado.nombre}, > :onchange => remote_function(:url => {:action => "find2"}, :with > => "'id=#{mercado.id}'") %> <%=mercado.nombre%><br /> > <% end %> > > but nothing happen when I click, no call to find2 The check_box helper doesn't take an :onchange option. You want to use observe_field to watch the check_box status. HTH, Bill
on 19.08.2008 22:30
Leonard Yera wrote: > hello list > I have this check_box in my code > > <% for mercado in @merca %> > <%= check_box "mercado", "nombre", {:value=>mercado.id, > :name=>mercado.nombre}, > :onchange => remote_function(:url => {:action => "find2"}, :with > => "'id=#{mercado.id}'") %> <%=mercado.nombre%><br /> > <% end %> > > but nothing happen when I click, no call to find2 > > any idea > > thanks You want to use :onclick. I have the same code (well, almost) in one of my apps. The only difference is that my remote_function call's value is placed within a variable: <% func1 = remote_function(:url => {:action => "find2"}, :with => "'id=# {mercado.id}'") %> <%= check_box "mercado", "nombre", {:value=>mercado.id, :name=>mercado.nombre}, :onclick => func1 %> -S
on 20.08.2008 20:02
Shandy, Fred; Thanks! I never knew we could use remote_function this way. Learning something new every day! Best regards, Bill