Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse events not reaching checkbox #15

Closed
baarden-zz opened this issue Jan 3, 2015 · 7 comments
Closed

Mouse events not reaching checkbox #15

baarden-zz opened this issue Jan 3, 2015 · 7 comments

Comments

@baarden-zz
Copy link

I encountered a problem where mouse events were not passing through the pseudoelement to the underlying checkbox. (Firefox 34 and Safari 8 on MacOS 10.10.)

I was able to fix it by adding "pointer-events: none;" to the .checkbox label::before/after selectors. Not sure if this is a good fix, though!

@AlonCG
Copy link

AlonCG commented Jan 7, 2015

I am having something similar happen (w/wo using an icon in the label)... though I have not modified the css yet (may try that tomorrow or so). Here is how the HTML is generated (using a standard checkbox works fine):

<div class="checkbox checkbox-info">
    <input data-val="true" data-val-required="The IsKey field is required." id="TableColumns_1__IsKey" name="TableColumns[1].IsKey" value="true" type="checkbox">
    <input name="TableColumns[1].IsKey" value="false" type="hidden">
    <label for="TableColumns_1__IsKey">Is Key<i class="fa fa-fw fa-key"></i></label>
</div>

The input tag is being generated from an ASP.NET MVC Razor tag, could that be a problem?

@JoelViney
Copy link

@AlonCG It doesn't like there being a hidden input with the same name. That is causing it to fail.

@micrum
Copy link
Contributor

micrum commented Mar 6, 2015

This problem fixed simply adding z-index equals 1 to inputs.
Check out Plunker

@micrum micrum closed this as completed in 1c73a34 Mar 6, 2015
@swilerdelp
Copy link

This issue has not been resolved. I have the most recent version and the checkbox value is not being changed by the mouse click.

@swilerdelp
Copy link

Sorry, I am incorrect, I did have a earlier version than the most recent. My apologies.

@mibamur
Copy link

mibamur commented Jul 4, 2016

@flatlogic reopen it

@rock-walker
Copy link

rock-walker commented Oct 7, 2016

I played with bootstrap checkbox and ASP.NET MVC CheckBoxFor for half a day
and applied solutions with "awesome-bootstrap-checkbox", thoroughly checked every line of code.
That didn't work for me!

As "@Html.CheckBoxFor" appended <input type="hidden" ... /> after checkbox input, the bootstrap checkbox become UNclickable. Unfortunately.

My solution to this problem is next:

  1. throw out "@Html.CheckBoxFor" from code and exchange it on classic
    <input type="checkbox" id="cb1" @(Model.SomeBoolProperty ? "checked" : "")/>
    <label for "cb1">Text</label>
  2. Add to the top of the *.cshtml page asp.net hidden control:
    @Html.HiddeFor(x => x.SomeBoolProperty)
    That control will store your value for a model.
  3. And in "Save"/"Post"/"Send" handler in javascript block update Hidden element value from Checkbox element (f.e., using JQuery):
    $('#SomeBoolProperty').val($('#cb1').is(':checked'))
    Thus your model will valid and actual for .NET Controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants