From 36f1dac36f14cbc53ece4d208d366e3203fd4a8c Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Wed, 13 Aug 2008 16:18:39 +0000 Subject: User interface improvements part #2 --- libs/cbi/htdocs/luci-static/resources/cbi.js | 30 +++++++++++++++------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'libs/cbi/htdocs') diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 01653e6e5..18ef42068 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -63,17 +63,19 @@ function cbi_combobox(id, values, def, man) { var sel = document.createElement("select"); obj.parentNode.appendChild(sel); - if (obj.value == "") { - var optdef = document.createElement("option"); - optdef.value = ""; - optdef.appendChild(document.createTextNode(def)); - sel.appendChild(optdef); - } else if (!values[obj.value]) { - var opt = document.createElement("option"); - opt.value = obj.value; - opt.selected = "selected"; - opt.appendChild(document.createTextNode(obj.value)); - sel.appendChild(opt); + if (!values[obj.value]) { + if (obj.value == "") { + var optdef = document.createElement("option"); + optdef.value = ""; + optdef.appendChild(document.createTextNode(def)); + sel.appendChild(optdef); + } else { + var opt = document.createElement("option"); + opt.value = obj.value; + opt.selected = "selected"; + opt.appendChild(document.createTextNode(obj.value)); + sel.appendChild(opt); + } } for (var i in values) { @@ -107,9 +109,9 @@ function cbi_combobox(id, values, def, man) { } function cbi_combobox_init(id, values, def, man) { - var obj = document.getElementById(id) + var obj = document.getElementById(id); cbi_bind(obj, "blur", function() { cbi_combobox(id, values, def, man) - }) - cbi_combobox(id, values, def, man) + }); + cbi_combobox(id, values, def, man); } \ No newline at end of file -- cgit v1.2.3