提交 142c31bc 编写于 作者: K kohsuke

support "../foo" to refer to the "foo" parameter of the parent scope (the...

support "../foo" to refer to the "foo" parameter of the parent scope (the scope in the sense of the structured form submission.)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@32530 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5e736c21
...@@ -140,14 +140,22 @@ var FormChecker = { ...@@ -140,14 +140,22 @@ var FormChecker = {
* and returns that DOM node. * and returns that DOM node.
*/ */
function findNearBy(e,name) { function findNearBy(e,name) {
// does 'e' itself match the criteria?
// as some plugins use the field name as a parameter value, instead of 'value'
var p = findFormItem(e,name,function(e,filter) { var p = findFormItem(e,name,function(e,filter) {
if (filter(e)) return e; if (filter(e)) return e;
return null; return null;
}); });
if (p!=null) return p; // including self, as some plugins use the field name as a parameter value, instead of 'value' if (p!=null) return p;
var owner = findFormParent(e,null); var owner = findFormParent(e,null);
// handle "../foo" syntax
while (name.startsWith("../")) {
owner = findFormParent(owner,null);
name = name.substring(3);
}
p = findPreviousFormItem(e,name); p = findPreviousFormItem(e,name);
if (p!=null && findFormParent(p,null)==owner) if (p!=null && findFormParent(p,null)==owner)
return p; return p;
...@@ -971,7 +979,7 @@ function refillOnChange(e,onChange) { ...@@ -971,7 +979,7 @@ function refillOnChange(e,onChange) {
function h() { function h() {
var params = {}; var params = {};
deps.each(function (d) { deps.each(function (d) {
params[shortenName(d.getAttribute("name"))] = controlValue(d); params[d.name] = controlValue(d.control);
}); });
onChange(params); onChange(params);
} }
...@@ -985,7 +993,7 @@ function refillOnChange(e,onChange) { ...@@ -985,7 +993,7 @@ function refillOnChange(e,onChange) {
return; return;
} }
c.addEventListener("change",h,false); c.addEventListener("change",h,false);
deps.push(c); deps.push({name:name,control:c});
}); });
} }
h(); // initial fill h(); // initial fill
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册