X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fcbi%2Fhtdocs%2Fluci-static%2Fresources%2Fcbi.js;h=d7bc74bc5f7d53ee639316a8beb87c3e6894ed70;hp=d0e31e483a9cee23b3a9bf381ff838a9ee09bb21;hb=c6143b89d3fe85cdb44fb579ad0e543749206db1;hpb=97ce1ad8adf935e2aa0d1b13f07b16d2d950053f diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index d0e31e483..d7bc74bc5 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -1,6 +1,6 @@ var cbi_d = []; -function cbi_d_add(field, dep) { +function cbi_d_add(field, dep, next) { var obj = document.getElementById(field); if (obj) { var entry @@ -12,61 +12,65 @@ function cbi_d_add(field, dep) { } if (!entry) { entry = { - "id": field, "node": obj, - "parent": obj.parentNode, - "next": obj.nextSibling, + "id": field, + "parent": obj.parentNode.id, + "next": next, "deps": [] }; cbi_d.unshift(entry); - } + } entry.deps.push(dep) } } -function cbi_d_value(target) { +function cbi_d_checkvalue(target, ref) { var t = document.getElementById(target); - var value - + var value; + if (!t || !t.value) { value = ""; } else { value = t.value; - + if (t.type == "checkbox") { value = t.checked ? value : ""; } } - - return value + + return (value == ref) } function cbi_d_check(deps) { for (var i=0; i