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%>
<% end %>
but nothing happen when I click, no call to find2
any idea
thanks
On 19 Aug 2008, at 20:11, Leonard Y. 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
Hi Leonard,
Leonard Y. 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%>
<% 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
Shandy, Fred;
Thanks! I never knew we could use remote_function this way. Learning
something new every day!
Best regards,
Bill
Leonard Y. 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%>
<% 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