Home > Software design >  Read html select value into jenkins Active Choices Reactive Parameter
Read html select value into jenkins Active Choices Reactive Parameter

Time:10-11

I saw many examples for Active Choices Reactive Parameter using formatted html, but none of these use the HTML select input type.

Here is my html snippet (simplified input of json_files for brevity):

def json_files = ["a", "b", "c"]

html_to_be_rendered = """<select id="config" name="config">"""

json_files.each { json_file ->
  html_to_be_rendered = """
    ${html_to_be_rendered}
    <option value="${json_file}">${json_file}</option>
"""
}

return "${html_to_be_rendered}</select>"

I thought I should be able to read the selected value using ${config}, but seems that doesn't work.

This is how I define it in the jenkins GUI:

enter image description here

What am I missing?

CodePudding user response:

The only problem you have is the name attribute of the select should be hard-coded to value. no need for the id attribute.

  • Related