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

Active Choices radio parameter has incorrect default value on parambuild URL

      Active Choice radio parameter on parambuild page is always visible as text box (which is fine). Unfortunately, the default value is set incorrectly. The plugin always fills the text box with the first value from the script and does not remove :selected suffix. It means that for the following script:

      ['1', '2', '3:selected', '4', '5']
      

      it returns 1, and for:

      ['1:selected', '2', '3', '4', '5']
      

      it returns 1:selected.

      This behavior makes radio button unusable when builds are triggered by Jenkins Pipeline build step or parambuild/buildWithParameters URLs.

        1. view-parambuild.png
          view-parambuild.png
          20 kB
        2. view-build-with-parameters.png
          view-build-with-parameters.png
          43 kB
        3. uno-choice.hpi
          248 kB
        4. reference-parameter.gif
          reference-parameter.gif
          107 kB
        5. parameter-configuration.png
          parameter-configuration.png
          9 kB
        6. parambuild.png
          parambuild.png
          11 kB
        7. image-2020-03-10-09-32-13-452.png
          image-2020-03-10-09-32-13-452.png
          13 kB
        8. image-2020-03-09-15-50-25-634.png
          image-2020-03-09-15-50-25-634.png
          88 kB
        9. build-with-parameters.png
          build-with-parameters.png
          32 kB

          [JENKINS-61068] Active Choices radio parameter has incorrect default value on parambuild URL

          Adam Gabryś created issue -

          Adam Gabryś added a comment -

          I created a pull request (PR #32) with the fix. Now it works as follow:

          Code Result Returns
          ['1:selected', '2', '3', '4', '5'] "1" the default value
          ['1', '2', '3:selected', '4', '5'] "3" the default value, no difference if it is first or last
          ['1', '2', '3', '4'] "1" the first element when (no values are marked as default)
          [] "" empty value (Jenkins cannot handle null)
          [""] "" the first element (no values are marked as default)
          ['1:selected', '2', '3:selected', '4'] "1,3" multiple values are checked, so all of them are added (consistent with Build with Parameters behavior)
          ['1', '2', ':selected', '4'] "" the empty element is marked as selected

          Adam Gabryś added a comment - I created a pull request ( PR #32 ) with the fix. Now it works as follow: Code Result Returns ['1:selected', '2', '3', '4', '5'] "1" the default value ['1', '2', '3:selected', '4', '5'] "3" the default value, no difference if it is first or last ['1', '2', '3', '4'] "1" the first element when (no values are marked as default) [] "" empty value (Jenkins cannot handle null) [""] "" the first element (no values are marked as default) ['1:selected', '2', '3:selected', '4'] "1,3" multiple values are checked, so all of them are added (consistent with Build with Parameters behavior) ['1', '2', ':selected', '4'] "" the empty element is marked as selected
          Bruno P. Kinoshita made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]
          Bruno P. Kinoshita made changes -
          Attachment New: uno-choice.hpi [ 50413 ]

          ioannis, attached the plugin hpi file for testing: uno-choice.hpi

          Bruno P. Kinoshita added a comment - ioannis , attached the plugin hpi file for testing: uno-choice.hpi

          Merged and added to the changelog for the next release. Thanks a lot agabrys!

          Bruno P. Kinoshita added a comment - Merged and added to the changelog for the next release. Thanks a lot agabrys !
          Ioannis Moutsatsos made changes -
          Attachment New: image-2020-03-09-15-50-25-634.png [ 50622 ]

          Ioannis Moutsatsos added a comment - - edited

          The 2.2.3 snapshot works. However, using Plugin v 2.1 and 2.2.2 I'm not able to reproduce the Jira issue as reported . In each case I get the correct default value selected. (see screenshot below)

          Nonetheless, I'm using older version of Jenkins ver. 2.121.3 and  Jenkins ver. 2.187

          Is it possible that this could be the difference causing the issue?

           

           

          Ioannis Moutsatsos added a comment - - edited The 2.2.3 snapshot works. However, using Plugin v 2.1 and 2.2.2 I'm not able to reproduce the Jira issue as reported . In each case I get the correct default value selected. (see screenshot below) Nonetheless, I'm using older version of Jenkins ver. 2.121.3 and  Jenkins ver. 2.187 Is it possible that this could be the difference causing the issue?    
          Adam Gabryś made changes -
          Attachment New: view-build-with-parameters.png [ 50631 ]
          Adam Gabryś made changes -
          Attachment New: view-parambuild.png [ 50632 ]

            kinow Bruno P. Kinoshita
            agabrys Adam Gabryś
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: