user1611183 user1611183 - 1 year ago 142
jQuery Question

bootstrap-combobox (by Daniel Farrel) and jquery-validaiton-plugin

Has anyone made the jquery.validate plugin working with the bootstrap-combobox created by Daniel Farrel ?

The jquery.validate plugin works pretty well with the remaining bootstrap elements, but can't get it working with the bootstrap-combobox.

Here is the html :

<div class="row">
<div class="col-sm-4">
<label for="categoryParent" class="control-label">Category</label>
<div class="col-sm-8">
<select id="categoryParent" name="categoryParent" class="combobox form-control">
<option value="" selected="selected">Select the category</option>


and the js :

highlight: function(element) {
unhighlight: function(element) {
errorElement: 'span',
errorClass: 'help-block',
errorPlacement: function(error, element) {

rules: {
categoryParent: {required: true}
messages: {
categoryParent : "Category required"

invalidHandler: function() {
submitHandler: function() {

// more code

return false;

Answer Source

Bootstrap ComboBox hides the original select and replaces it with something more visually appealing. However, the jQuery Validate plugin can only validate the original select element, but will also ignore it because it is hidden.

You simply have to use the ignore option to tell it to validate hidden elements.

ignore: []  // ignore nothing, validate everything

In your code:

    ignore: [],
    rules: { ....


    ignore: [],
    highlight: function(element) { ....
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download