Disabled check_box does not work as expected?


#1

I have a checkbox:

<%= check_box(:day, :monday, {:disabled => ‘’} , (day.monday == true ?
{:checked => ‘checked’} : {:checked => false} )) %>

It is disabled allright, but it is always uncecked. Is this supposed to
happen. It looks like

(day.monday == true ? {:checked => ‘checked’} : {:checked => false} )

is not working if disabled is used…


#2

oomtuinstoel <oomtuinstoelNO@…> writes:

<%= check_box(:day, :monday, {:disabled => ‘’} , (day.monday == true ?
{:checked => ‘checked’} : {:checked => false} )) %>

It is disabled allright, but it is always uncecked. Is this supposed to
happen. It looks like

(day.monday == true ? {:checked => ‘checked’} : {:checked => false} )

is not working if disabled is used…

I haven’t looked at the rails code to verify this,
but it seems like it should be:
<%= check_box(:day, :monday, {:disabled => ‘’, :checked =>
day.monday == true ? ‘checked’ : false } )) %>


#3

Danger Stevens wrote:
I haven’t looked at the rails code to verify this,
but it seems like it should be:
<%= check_box(:day, :monday, {:disabled => ‘’, :checked =>
day.monday == true ? ‘checked’ : false } )) %>

<%= check_box(:day, :monday, (day.monday == true ? {:checked =>
‘checked’, :disabled => ‘’} : {:checked => false, :disabled => ‘’} ) )
%>

dit the trick! Thanks for your pointer!