I am using jQuery Validate plugin ( jqueryvalidation.org ) and trying to validate dropdown. The problem is that my dropdown use bootstrap-select plugin and that means library converts "normal" dropdown into div (for styling, live-search etc.) more info about boostrap-select - https://silviomoreto.github.io/bootstrap-select/examples/.
My question is how can I use jQuery Validator plugin options on this boostrap-select dropdown.
Here is my code
echo $this->Form->input('customer_number', [
 'options' => $customer_number_list,
 'id' => 'customer_number',
 'class' => 'selectpicker',
 'empty' => __('All'),
 'label' => __('Customer number'),
 'value' => $this->request->data['customer_number'] ?? '',
 'onchange' => 'getDestinationList()'
]);
And below is jQuery Validator configuration (rules and messages)
<script type="text/javascript" src="/js/jquery-validation/jquery.validate.js"></script>
<script>
  $(document).ready(function() {
    $('#change_destination').validate({
      rules: {
        customer_number: {
          required: true
        }
      },
      messages: {
        customer_number: {
          required: 'Please select a template'
        }
      },
      submitHandler: function(form) { // blocks submission for demo
        $('.selectpicker').selectpicker('refresh');
        return false;
      }
    });
  });
</script>
This code works if I change my dropdown class in form-control (but then my dropdown doesnt have "nice" look and other features what I am getting from bootstrap selectpicker library. Here is an example of Bootstrap dropdown library (https://silviomoreto.github.io/bootstrap-select/examples/)
Thank you
 
     
    