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

Checkboxes don't work with Spring MVC JSTL #14

Closed
matthiasrohr opened this issue Jan 1, 2015 · 1 comment
Closed

Checkboxes don't work with Spring MVC JSTL #14

matthiasrohr opened this issue Jan 1, 2015 · 1 comment
Labels

Comments

@matthiasrohr
Copy link

Hi! First of all: Great work! Unfortunately, the checkboxes do not seem to work with Spring MVC JSTL. There seems to be a problem with the hidden input field that is inserted by the form:checkbox tag automatically after the checkbox input field. Here is an example of how the generated HTML looks like:

<div class="checkbox checkbox-primary"> <input id="checkbox1" name="enabled" type="checkbox" value="true"/><input type="hidden" name="_enabled" value="on"/> <label for="checkbox1">Primary</label> </div>

When I remove the hidden field or move it after the label it works fine (but this is of course not really an option here). I tested this with both Chrome and Firefox.

@okendoken
Copy link
Member

Hi @matthiasrohr

Thanks for your appreciation!

A visible checkbox is triggered when actual input changes its state to :checked. This is achieved by using + selector in this line - https://github.com/flatlogic/awesome-bootstrap-checkbox/blob/master/awesome-bootstrap-checkbox.css#L39

.checkbox input[type="checkbox"]:checked + label::after {
    font-family: 'FontAwesome';
    content: "\f00c"; }

In order to fix the problem we need to change + to ~. As discussed in #1 we've decided to leave + selector because of its better compatibility.

I am not familiar with Spring MVC components but I would advice to try to find a way to override/extend the component you are using.

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

No branches or pull requests

3 participants