I am facing problem to validate select which is beautified using bootstrap-select.js plugin using jquery validate plugin. bootstrap-select.js is expecting class selectpicker and following one line of code:
$('.selectpicker').selectpicker();
for beautifying select of html.
However it is causing problem in validations using jquery validate plugin. The select in not at all validated unless and untill class selectpicker in not removed. Once class is removed then validations are properly performed. Following is my html for select:
<select class="input-medium required" id="editCategory_sltCategoryName"
name="editCategory_sltCategoryName">
<option value="">
Select Category
</option>
<option>
Reusable Components
</option>
<option>
BU Connects
</option>
</select>
and following is the js:
$('#frm_editCategory').validate({
rules: {
editCategory_sltbuName: {
required: true
},
editCategory_sltCategoryName: {
required: true
},
editCategory_categoryName: {
minlength: 2,
required: true,
buname: true
},
editCategory_categoryDescription: {
minlength: 2,
required: true,
buname: true
}
},
highlight: function(element) {
$(element).closest('.control-group')
.removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid')
.closest('.control-group')
.removeClass('error').addClass('success');
},
submitHandler: function(event) {
return true;
}
});
I have tried to do it by writing custom method for it also but it is of no use.