Skip empty plugin config keys
The web UI no longer submits those, so they will be omitted when the
plugin runs, causing it to run defaults.
var field = $ctl.data('field');
var key = field.replace(/^config\./, '');
- if ($ctl.is('.required') && data.config[key] == "") {
+ if ($ctl.is('.required') && !(key in data.config)) {
$form.error(field, 'missing');
- } else if (data.config[key] != "") {
+ } else if (key in data.config) {
switch (type) {
case "abspath":
if (!data.config[key].match(/^\//)) {
if (!('config' in data)) {
data.config = {};
}
+ for (var k in data.config) {
+ if (data.config[k] == "") {
+ delete data.config[k];
+ }
+ }
return data;
};
