So after being convinced this was a JS issue, it turns out it was a CSS issue.  
Thank you to Adam and Joe for jumping in.  Thank you NOT to Matt and David for 
jumping in.  

The culprit was that the checkbox input was inheriting a style

-webkit-appearance: none

So when changing it to  

-webkit-appearance: checkbox

it all worked.  No point in wondering why this was the case as it all makes 
sense within the context of the bootstrap template I am using.

TIL how to do CSS debugging in Chrome.  Thanks to @bensie I also found a 
helpful resource about all this here: 
http://css-tricks.com/almanac/properties/a/appearance/

Thanks!

Etienne  


On Wednesday, May 29, 2013 at 9:47 AM, Joe Fox wrote:

> Adam has a good point… there could be an overly broad javascript/jquery 
> selector that is intercepting the onChange event and returning false. That 
> would explain the behavior as well.
>  
> -Joe
>  
> On May 29, 2013, at 9:44 AM, Adam Grant <[email protected] 
> (mailto:[email protected])> wrote:
> > By pasting your snippet of HTML generated into the HTML body of a site, it 
> > shows a nice little checkbox that I'm able to visible "check" when clicked. 
> > I'd say if you don't see the 'check' mark after clicking it, it might be 
> > your CSS. Can you inspect it in Chrome or FF and disable any styles applied 
> > to it to see if that has an effect? Maybe also comment out your CSS <style> 
> > tags in your layout and refresh the page to see if anything is messing with 
> > it. I wouldn't imagine something is intercepting the "change" action on it, 
> > but you might have some funky JS being initialized.  
> >  
> >  
> > On Wed, May 29, 2013 at 9:40 AM, Etienne de Bruin <[email protected] 
> > (mailto:[email protected])> wrote:
> > > b.  
> > >  
> > > Apologies for not clarifying.  
> > >  
> > >  
> > > On Wednesday, May 29, 2013, Adam Grant wrote:
> > > > When you say it's "not checking", do you mean:
> > > >  
> > > > a) it doesn't visibly get rendered as checked on page load if 
> > > > @employment.present == 1, or  
> > > > b) that when you click it it doesn't check, or  
> > > > c) when you submit it when it's checked, it doesn't submit 
> > > > "employment[present] = 1"?
> > > >  
> > > > - Adam
> > > >  
> > > >  
> > > > On Wed, May 29, 2013 at 9:35 AM, Etienne de Bruin <[email protected]> 
> > > > wrote:
> > > > > Roobs!
> > > > >  
> > > > > I'm having a hard time getting my checkbox to check in my rails app.  
> > > > > I've got it down to thinking this is a JS or CSS issue since I am 
> > > > > using a bootstrap theme.  If anyone knows what the reasons are behind 
> > > > > checkboxes not checking from past experience I would greatly 
> > > > > appreciate some pointers.  Here is a gist of how I am using form_for 
> > > > > with the generated html in my comment:
> > > > >  
> > > > > https://gist.github.com/etdebruin/5671416
> > > > >  
> > > > > Thank you for your time.
> > > > >  
> > > > > Etienne  
> > > > >  
> > > > > --  
> > > > > --  
> > > > > SD Ruby mailing list
> > > > > [email protected]
> > > > > http://groups.google.com/group/sdruby
> > > > > ---  
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups "SD Ruby" group.
> > > > > To unsubscribe from this group and stop receiving emails from it, 
> > > > > send an email to [email protected].
> > > > > For more options, visit https://groups.google.com/groups/opt_out.
> > > > >   
> > > > >   
> > > >  
> > > >  
> > > > --  
> > > > --  
> > > > SD Ruby mailing list
> > > > [email protected]
> > > > http://groups.google.com/group/sdruby
> > > > ---  
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "SD Ruby" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send 
> > > > an email to [email protected].
> > > > For more options, visit https://groups.google.com/groups/opt_out.
> > > >   
> > > >   
> > >  
> > > --  
> > > --  
> > > SD Ruby mailing list
> > > [email protected] (mailto:[email protected])
> > > http://groups.google.com/group/sdruby
> > > ---  
> > > You received this message because you are subscribed to the Google Groups 
> > > "SD Ruby" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an 
> > > email to [email protected] 
> > > (mailto:sdruby%[email protected]).
> > > For more options, visit https://groups.google.com/groups/opt_out.
> > >   
> > >   
> >  
> >  
> > --  
> > --  
> > SD Ruby mailing list
> > [email protected] (mailto:[email protected])
> > http://groups.google.com/group/sdruby
> > ---  
> > You received this message because you are subscribed to the Google Groups 
> > "SD Ruby" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to [email protected] 
> > (mailto:[email protected]).
> > For more options, visit https://groups.google.com/groups/opt_out.
> >   
> >   
>  
> --  
> --  
> SD Ruby mailing list
> [email protected] (mailto:[email protected])
> http://groups.google.com/group/sdruby
> ---  
> You received this message because you are subscribed to the Google Groups "SD 
> Ruby" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> (mailto:[email protected]).
> For more options, visit https://groups.google.com/groups/opt_out.
>   
>   

-- 
-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
--- 
You received this message because you are subscribed to the Google Groups "SD 
Ruby" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to