Disabled check_box does not work as expected?

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…

oomtuinstoel <[email protected]…> 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 } )) %>

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!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs