Example: I have 6 different checkboxes. All of them are with name="checkbox[]"
, one of them must be marked with 1 or true.
Here's an example in jsfiddle: link
The "SUBMIT" button is not working.
Update - Try 1
Here's jsfiddle: link
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">Material Design Switch Demos</div>
<!-- List group -->
<ul class="list-group">
<li class="list-group-item">
Bootstrap Switch Default
<div class="material-switch pull-right">
<input id="someSwitchOptionDefault" name="checkbox[]" type="checkbox" />
<label for="someSwitchOptionDefault" class="label-default"></label>
</div>
</li>
<li class="list-group-item">
Bootstrap Switch Primary
<div class="material-switch pull-right">
<input id="someSwitchOptionPrimary" name="checkbox[]" type="checkbox" />
<label for="someSwitchOptionPrimary" class="label-primary"></label>
</div>
</li>
<li class="list-group-item">
Bootstrap Switch Success
<div class="material-switch pull-right">
<input id="someSwitchOptionSuccess" name="checkbox[]" type="checkbox" />
<label for="someSwitchOptionSuccess" class="label-success"></label>
</div>
</li>
<li class="list-group-item">
Bootstrap Switch Info
<div class="material-switch pull-right">
<input id="someSwitchOptionInfo" name="checkbox[]" type="checkbox" />
<label for="someSwitchOptionInfo" class="label-info"></label>
</div>
</li>
<li class="list-group-item">
Bootstrap Switch Warning
<div class="material-switch pull-right">
<input id="someSwitchOptionWarning" name="checkbox[]" type="checkbox" />
<label for="someSwitchOptionWarning" class="label-warning"></label>
</div>
</li>
<li class="list-group-item">
Bootstrap Switch Danger
<div class="material-switch pull-right">
<input id="someSwitchOptionDanger" name="checkbox[]" type="checkbox" />
<label for="someSwitchOptionDanger" class="label-danger"></label>
</div>
</li>
</ul>
</div>
JS:
$("#myform").validate({
ignore: ":hidden",
rules: {
"checkbox": { required: true, minlength: 1 },
},
messages: {
"checkbox[]": "<span style=\"color: #a94442;\">Uma das opções deve ser marcada *</span>"
},
Any solution?