Working on implementing the jQuery Validation plugin for the authentication settings editor.

This commit is contained in:
Matt Scott 2023-04-10 18:35:25 -04:00
parent cf62890fcf
commit ea10b814d6
No known key found for this signature in database
GPG Key ID: A9A0AFFC0E079001

View File

@ -323,6 +323,26 @@ let AuthenticationSettingsModel = function (user_data, api_url, csrf_token, sele
element.after(error);
}
},
showErrors: function (errorMap, errorList) {
this.defaultShowErrors();
let selectors = [
'input.error:not([disabled])',
'select.error:not([disabled])',
'textarea.error:not([disabled])',
];
let selector_query = selectors.join(',');
let tabs = target.find('.tab-content > *[data-tab]')
tabs.each(function (index, tab) {
tab = $(tab);
let tabId = tab.data('tab');
let tabLink = target.find('.nav-tabs > li > a[data-tab="' + tabId + '"]');
if (tab.find(selector_query).length > 0) {
tabLink.addClass('error');
} else {
tabLink.removeClass('error');
}
});
},
rules: {
local_db_enabled: 'auth_enabled',
ldap_enabled: 'auth_enabled',