From 0e5b8c706fa204318c7d85de898def990aa0e802 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 12 Aug 2010 04:08:57 +0000 Subject: [PATCH] allow the @value to be used if present. This is useful when creating a list of check boxes and bind it to List git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@33719 71c3de6d-444a-0410-be80-ed276b4c234a --- war/resources/scripts/hudson-behavior.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/war/resources/scripts/hudson-behavior.js b/war/resources/scripts/hudson-behavior.js index 110afdf534..d994685481 100644 --- a/war/resources/scripts/hudson-behavior.js +++ b/war/resources/scripts/hudson-behavior.js @@ -1683,9 +1683,15 @@ function buildFormTree(form) { case "checkbox": p = findParent(e); var checked = xor(e.checked,Element.hasClassName(e,"negative")); - if(!e.groupingNode) - addProperty(p, e.name, checked); - else { + if(!e.groupingNode) { + v = e.getAttribute("value"); + if (v) {// if the value is present, we'll either set the value or not. useful for an array of checkboxes + if (checked) + addProperty(p, e.name, v); + } else {// otherwise it'll bind to boolean + addProperty(p, e.name, checked); + } + } else { if(checked) addProperty(p, e.name, e.formDom = {}); } -- GitLab