{"issue":{"state":"open","created_at":"2011-11-22T20:58:26Z","updated_at":"2011-11-23T18:07:59Z","user":{"gravatar_id":"e9a8bff1c561921701eb3ceabea83e92","id":742293,"url":"https://api.github.com/users/jbeasley6651","login":"jbeasley6651","avatar_url":"https://secure.gravatar.com/avatar/e9a8bff1c561921701eb3ceabea83e92?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"comments":2,"body":"Loading an edit form via ajax and then in the callback activating the script is causing the checkboxes to losing their click-events after the first click.\r\n","assignee":null,"id":2322956,"labels":[],"number":50,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"ajax'd partials with checkboxes do not work","closed_at":null,"html_url":"https://github.com/tdreyno/iphone-style-checkboxes/issues/50","milestone":null,"url":"https://api.github.com/repos/tdreyno/iphone-style-checkboxes/issues/50"},"action":"created","comment":{"created_at":"2011-11-23T18:07:59Z","updated_at":"2011-11-23T18:07:59Z","user":{"gravatar_id":"e9a8bff1c561921701eb3ceabea83e92","id":742293,"url":"https://api.github.com/users/jbeasley6651","login":"jbeasley6651","avatar_url":"https://secure.gravatar.com/avatar/e9a8bff1c561921701eb3ceabea83e92?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"body":"What was happening is Formtastic was generating this markup for boolean_input.rb \r\n\r\n    #         <li class=\"boolean\" id=\"post_published_input\">\r\n    #           <input type=\"hidden\" name=\"post[published]\" id=\"post_published\" value=\"0\">\r\n    #           <label for=\"post_published\">\r\n    #             <input type=\"checkbox\" name=\"post[published]\" id=\"post_published\" value=\"1\">\r\n    #             Published?\r\n    #           </label>\r\n    #         </li>\r\n\r\nWhen the checkbox is under a label like that it does not work. In webkit if you drag the input out slide the label (just 1 node above) it works as expected. \r\n\r\nTo fix this I create my own custom input class and copied the majority of the code from the original boolean_input.rb \r\n\r\nhttps://raw.github.com/justinfrench/formtastic/master/lib/formtastic/inputs/boolean_input.rb\r\n\r\nThen just edited the to_html:\r\n\r\n  def to_html\r\n    input_wrapping do\r\n      check_box_html\r\n    end\r\n  end\r\n\r\nThis makes the checkbox stand-alone, and everything works perfectly. (i didn't need a label for my specific case, so i did away with it.\r\n\r\n    #         <li class=\"boolean\" id=\"post_published_input\">\r\n    #             <input type=\"checkbox\" name=\"post[published]\" id=\"post_published\" value=\"1\">\r\n    #         </li>\r\n\r\nI don't know if a bug should be opened for the ios-checkboxes or not. I just hope this comment helps anyone coming across this.","id":2852368,"url":"https://api.github.com/repos/tdreyno/iphone-style-checkboxes/issues/comments/2852368"}}