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

Active choice parameter filter throws JavaScript error for parameter change event in browser console

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • active-choices-plugin
    • None
    • Jenkins 2.462.3
      Active Choices Plugin 2.8.4
      JDK 17
      Chrome/Edge browsers

      Use Case:

      • Pipeline
      • Active choice single select with filter parameter - paramA
      • Active reactive choice parameter - paramB that dispays options based on paramA
      • Filter paramA

       

      Expected results:

      Typing in filter of paramA, expect paramB to update its options based on the selected value in paramA dropdown.

       

      Actual results:

      paramB not updated (see attachments) and browser dev tools shows JS error (see attachments).

       

      Additional notes:

      • Manually selecting a new option in paramA dropdown works just fine.
      • Filtering down to one option does not allow manual selection since it is already selected.

       

      Test pipeline:

      #!groovy
      
      properties([
          parameters([
              [
                  $class: 'ChoiceParameter',
                  choiceType: 'PT_SINGLE_SELECT',
                  description: 'Choose opion',
                  filterLength: 1,
                  filterable: true,
                  name: 'paramA',
                  script: [
                      $class: 'GroovyScript',
                      script: [
                          classpath: [],
                          sandbox: true,
                          script: 'return ["AAA","BBB","CCC"]'
                      ],
                      fallbackScript: [
                          classpath: [],
                          sandbox: true,
                          script: 'return["ERROR paramA"]'
                      ]
                  ]
              ],
              [
                  $class: 'CascadeChoiceParameter',
                  choiceType: 'PT_RADIO',
                  description: 'chose related option',
                  filterLength: 1,
                  filterable: false,
                  name: 'paramB',
                  referencedParameters: 'paramA',
                  script: [
                      $class: 'GroovyScript',
                      script: [
                          classpath: [],
                          sandbox: true,
                          script: '''
                              if (paramA.equals("AAA")) {
                                  return ["AAA-1","AAA-2","AAA-3"]
                              }
                              else if (paramA.equals("BBB")) {
                                  return ["BBB-1","BBB-2","BBB-3"]
                              }
                              else if (paramA.equals("CCC")) {
                                  return ["CCC-1","CCC-2","CCC-3"]
                              }
                              else {
                                  return ["UNK"]
                              }
                          '''
                      ],
                      fallbackScript: [
                          classpath: [],
                          sandbox: true,
                          script: 'return["ERROR paramB"]'
                      ]
                  ]
              ]
          ])
      ])
      
      pipeline {
          agent any
      
          stages {
              stage('Params') {
                  steps {
                      echo "paramA: ${params.paramA}"
                      echo "paramB: ${params.paramB}"
                  }
              }
          }
      }
      

        1. active-choice-browser-devtools-view.png
          67 kB
          D. Saville
        2. active-choice-UI-view.png
          12 kB
          D. Saville
        3. config-working-bruno-2.8.7-snapshot-1.xml,
          3 kB
          Bruno P. Kinoshita
        4. image-2025-02-02-18-05-59-442.png
          164 kB
          Bruno P. Kinoshita
        5. image-2025-02-02-18-06-18-183.png
          61 kB
          Bruno P. Kinoshita
        6. image-2025-02-11-10-00-05-565.png
          27 kB
          D. Saville
        7. image-2025-02-11-10-01-29-865.png
          28 kB
          D. Saville
        8. image-2025-03-16-10-01-25-844.png
          88 kB
          Bruno P. Kinoshita
        9. image-2025-03-16-10-02-57-734.png
          165 kB
          Bruno P. Kinoshita
        10. image-2025-03-16-10-05-55-443.png
          102 kB
          Bruno P. Kinoshita
        11. image-2025-03-16-10-06-15-670.png
          105 kB
          Bruno P. Kinoshita

            kinow Bruno P. Kinoshita
            chamacs D. Saville
            Votes:
            8 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              Resolved: