mirror of https://github.com/jenkinsci/jenkins.git
[JENKINS-72505] f:validateButton finds selected radio button (#8832)
JENKINS-72505 f:validateButton finds selected radio button Co-authored-by: Mark Waite <mark.earl.waite@gmail.com> Co-authored-by: Alexander Brandes <mc.cache@web.de>
This commit is contained in:
parent
8088f30d39
commit
d2a9fd2b1f
|
@ -109,13 +109,16 @@ public class ValidateButtonTest {
|
|||
|
||||
public void doValidateTest1(@QueryParameter("a") String a, @QueryParameter("b") boolean b,
|
||||
@QueryParameter("c") boolean c, @QueryParameter("d") String d,
|
||||
@QueryParameter("e") String e) {
|
||||
@QueryParameter("e") String e,
|
||||
@QueryParameter("f") String f
|
||||
) {
|
||||
try {
|
||||
assertEquals("avalue", a);
|
||||
assertTrue(b);
|
||||
assertFalse(c);
|
||||
assertEquals("dvalue", d);
|
||||
assertEquals("e2", e);
|
||||
assertEquals("f", f);
|
||||
test1Outcome = null;
|
||||
} catch (RuntimeException t) {
|
||||
test1Outcome = t;
|
||||
|
|
|
@ -50,7 +50,27 @@ THE SOFTWARE.
|
|||
<f:option value="e2" selected="true">e2</f:option>
|
||||
</select>
|
||||
</f:entry>
|
||||
<f:validateButton method="validateTest1" title="test" with="a,b,c,d,e" />
|
||||
|
||||
<f:entry title="f">
|
||||
<f:radioBlock name="f" value="notf" title="fa" checked="false">
|
||||
<f:entry title="fa">
|
||||
<f:textbox name="fa"/>
|
||||
</f:entry>
|
||||
</f:radioBlock>
|
||||
|
||||
<f:radioBlock name="f" value="f" title="fb" checked="true">
|
||||
<f:entry title="fb">
|
||||
<f:textbox name="fb"/>
|
||||
</f:entry>
|
||||
</f:radioBlock>
|
||||
|
||||
<f:radioBlock name="f" value="reallynotf" title="fb" checked="false">
|
||||
<f:entry title="fc">
|
||||
<f:textbox name="fc"/>
|
||||
</f:entry>
|
||||
</f:radioBlock>
|
||||
</f:entry>
|
||||
<f:validateButton method="validateTest1" title="test" with="a,b,c,d,e,f" />
|
||||
</f:form>
|
||||
</l:main-panel>
|
||||
</l:layout>
|
||||
|
|
|
@ -2708,8 +2708,13 @@ function validateButton(checkUrl, paramList, button) {
|
|||
paramList.split(",").forEach(function (name) {
|
||||
var p = findPreviousFormItem(button, name);
|
||||
if (p != null) {
|
||||
if (p.type == "checkbox") {
|
||||
if (p.type === "checkbox") {
|
||||
parameters[name] = p.checked;
|
||||
} else if (p.type === "radio") {
|
||||
while (p && !p.checked) {
|
||||
p = findPreviousFormItem(p, name);
|
||||
}
|
||||
parameters[name] = p.value;
|
||||
} else {
|
||||
parameters[name] = p.value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue