problem in check_box

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

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

the onchange should be part of the same options has as :value and :name

Fred

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

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

Shandy, Fred;

Thanks! I never knew we could use remote_function this way. Learning something new every day!

Best regards, Bill