luci-base: form.js: only update option default if cfgvalue is null
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
63f28fd065
commit
d10575dfee
1 changed files with 2 additions and 1 deletions
|
@ -722,6 +722,7 @@ var CBIAbstractValue = CBINode.extend({
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var config_name = this.uciconfig || this.section.uciconfig || this.map.config,
|
var config_name = this.uciconfig || this.section.uciconfig || this.map.config,
|
||||||
|
cfgvalue = L.toArray(this.cfgvalue(section_id))[0],
|
||||||
default_defval = null, satisified_defval = null;
|
default_defval = null, satisified_defval = null;
|
||||||
|
|
||||||
for (var value in this.defaults) {
|
for (var value in this.defaults) {
|
||||||
|
@ -739,7 +740,7 @@ var CBIAbstractValue = CBINode.extend({
|
||||||
satisified_defval = default_defval;
|
satisified_defval = default_defval;
|
||||||
|
|
||||||
var node = this.map.findElement('id', this.cbid(section_id));
|
var node = this.map.findElement('id', this.cbid(section_id));
|
||||||
if (node && node.getAttribute('data-changed') != 'true' && satisified_defval != null)
|
if (node && node.getAttribute('data-changed') != 'true' && satisified_defval != null && cfgvalue == null)
|
||||||
L.dom.callClassMethod(node, 'setValue', satisified_defval);
|
L.dom.callClassMethod(node, 'setValue', satisified_defval);
|
||||||
|
|
||||||
this.default = satisified_defval;
|
this.default = satisified_defval;
|
||||||
|
|
Loading…
Reference in a new issue