Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5028

Collision between radioBlocks when used in a Builder

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None

      Consider the following in the config.jelly file for a BuildStep implementation:

      <f:block>
      <f:radioBlock name="commandsOrScriptFile" value="commands" title="${%Run a set of commands}" checked="${!empty instance.commands}">
      <f:entry title="${%Commands}" field="commands">
      <f:expandableTextbox name="wasbuildstep.commands" value="${instance.commands}"/>
      </f:entry>
      </f:radioBlock>
      <f:radioBlock name="commandsOrScriptFile" value="scriptFile" title="${%Run a script file}" checked="${!empty instance.scriptFile}">
      <f:entry title="${%Script file}" field="scriptFile">
      <f:textbox name="wasbuildstep.scriptFile" value="${instance.scriptFile}"/>
      </f:entry>
      </f:radioBlock>
      </f:block>

      This would render as shown in the attached screenshot.
      This code works fine when the builder is used just once. But when the builder is used twice or more in the same job, the ids/names of the radio buttons conflict: If the radio button of builder #n is selected, then the radio buttons of all other similar builders are unchecked, and vice-versa.
      The point is that the addRadioBlock() function in hudson-behavior.js is called only once, when the config page of the job gets loaded, so there's no way to tweak the ids/names there.

          [JENKINS-5028] Collision between radioBlocks when used in a Builder

          Code changed in hudson
          User: : mindless
          Path:
          trunk/www/changelog.html
          http://jenkins-ci.org/commit/29096
          Log:
          [FIXED JENKINS-5028] add link to existing issue fixed by r29065

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/www/changelog.html http://jenkins-ci.org/commit/29096 Log: [FIXED JENKINS-5028] add link to existing issue fixed by r29065

          Alan Harder added a comment -

          Please do test this when 1.353 comes out.. I did a quick test and it look OK, but most of my testing while working on this fix was with f:repeatable, and build steps are going through f:hetero-list.

          Alan Harder added a comment - Please do test this when 1.353 comes out.. I did a quick test and it look OK, but most of my testing while working on this fix was with f:repeatable, and build steps are going through f:hetero-list.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/test/src/test/java/lib/form/RepeatableTest.java
          trunk/hudson/main/test/src/test/resources/lib/form/RepeatableTest/testNested.jelly
          trunk/hudson/main/test/src/test/resources/lib/form/RepeatableTest/testNestedRadio.jelly
          trunk/hudson/main/war/resources/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/29170
          Log:
          JENKINS-5028 expand radiobutton support in repeatable content
          to work in nested repeatables.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/test/src/test/java/lib/form/RepeatableTest.java trunk/hudson/main/test/src/test/resources/lib/form/RepeatableTest/testNested.jelly trunk/hudson/main/test/src/test/resources/lib/form/RepeatableTest/testNestedRadio.jelly trunk/hudson/main/war/resources/scripts/hudson-behavior.js http://jenkins-ci.org/commit/29170 Log: JENKINS-5028 expand radiobutton support in repeatable content to work in nested repeatables.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/main/war/resources/scripts/hudson-behavior.js
          http://jenkins-ci.org/commit/29202
          Log:
          JENKINS-5028 reselect any radiobuttons unselected by browser before names uniquified

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/main/war/resources/scripts/hudson-behavior.js http://jenkins-ci.org/commit/29202 Log: JENKINS-5028 reselect any radiobuttons unselected by browser before names uniquified

          Romain Seguy added a comment -

          OK, I'll do the test with the Groovy plugin which has the "bug" built inside

          Romain Seguy added a comment - OK, I'll do the test with the Groovy plugin which has the "bug" built inside

          Romain Seguy added a comment -

          The Groovy plugin works fine with 1.353: It's new possible to add several times the build step.

          Romain Seguy added a comment - The Groovy plugin works fine with 1.353: It's new possible to add several times the build step.

            mindless Alan Harder
            rseguy Romain Seguy
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: