You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
I have create a custom validation to check if the user have select one or more items on select2 field with multiselect option, if user didn't have select nothing the validation is not pass.
I have 2 problems:
custom function is call only when I call validator('validate') but not when select2 is unfocus;
when call validator('validate') custom function is call but the class "has-error" is not added to form group so the form is submit.
My JS code:
$('#saveinvoice').validator({
custom: {
'customers': function($el) {
if ($el.select2('data').length==0) {
return "Select one or more customers!";
}
}
}
});
function submitInvoiceData(){
if ($('#saveinvoice').validator('validate').has('.has-error').length == 0) {
...
document.getElementById('saveinvoice').submit();
};
}
I have create a custom validation to check if the user have select one or more items on select2 field with multiselect option, if user didn't have select nothing the validation is not pass.
I have 2 problems:
My JS code:
My HTML code:
The text was updated successfully, but these errors were encountered: