updated settings module (v2) to fix multiple selects and checkboxes using name instead of id, which isn't always guaranteed to be set.

v1.18.x
Julian Lam 10 years ago
parent d096a639d6
commit a3cadff1d3

@ -482,14 +482,14 @@ define('settings', function () {
formEl.find('input[type="checkbox"]').each(function (idx, inputEl) { formEl.find('input[type="checkbox"]').each(function (idx, inputEl) {
inputEl = $(inputEl); inputEl = $(inputEl);
if (!inputEl.is(':checked')) { if (!inputEl.is(':checked')) {
values[inputEl.attr('id')] = 'off'; values[inputEl.attr('name')] = 'off';
} }
}); });
// Normalizing value of multiple selects // Normalizing value of multiple selects
formEl.find('select[multiple]').each(function(idx, selectEl) { formEl.find('select[multiple]').each(function(idx, selectEl) {
selectEl = $(selectEl); selectEl = $(selectEl);
values[selectEl.attr('id')] = JSON.stringify(selectEl.val()); values[selectEl.attr('name')] = JSON.stringify(selectEl.val());
}); });
socket.emit('admin.settings.set', { socket.emit('admin.settings.set', {

Loading…
Cancel
Save