[Rails] Simple check_box

2011-05-19 Thread Eric M.
Hello, I'm trying create a simple check_box that if checked include a hidden_field, but I haven't success. Something like this: p class=field/p %= check_box_tag(:patrono, value = 1, checked = false, options = {}) % %= f.label Patrono % % if :patrono.checked == true % %=

Re: [Rails] Simple check_box

2011-05-19 Thread Tom Meinlschmidt
hi, use jQuery and then = f.hidden_field_tag hidden_field, value, { :id = hidden_field} = f.check_box_tag name, 1,false, {:id = my_checkbox} jQuery('#my_checkbox').bind('click', function() { jQuery('#hidden_field').attr('disabled', !jQuery(this).attr('checked')); } when field is disabled,