You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins Active Choices Reactive Parameter无法读取HTML select选中值问题

问题根因

你自定义的<select>元素未遵循Active Choices插件的命名约定:插件只会识别**name属性值为value**的表单输入元素,你当前配置的name="config"不会被插件捕获,自然无法将选中值绑定到参数。

修正后的Groovy代码
def json_files = ["a", "b", "c"]

// 仅修改name属性为固定值value即可
html_to_be_rendered = """<select id="config" name="value">"""

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>"
额外配置校验项
  • 确认你在Active Choices Reactive Parameter配置页填写的参数名称为config,后续构建流程即可正常通过${config}读取选中值
  • 如果需要支持多选,把select标签修改为<select id="config" name="value" multiple>即可,插件会自动返回选中值的数组

内容的提问来源于stack exchange,提问作者YaOg

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.30 17:36:02