简体   繁体   English

将 html select 值读入 jenkins Active Choices Reactive Parameter

[英]Read html select value into jenkins Active Choices Reactive Parameter

I saw many examples for Active Choices Reactive Parameter using formatted html, but none of these use the HTML select input type.我看到许多使用格式化 html 的 Active Choices Reactive Parameter 示例,但没有一个使用 HTML select 输入类型。

Here is my html snippet (simplified input of json_files for brevity):这是我的 html 片段(为简洁起见,简化了 json_files 的输入):

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.我认为我应该能够使用 ${config} 读取选定的值,但似乎不起作用。

This is how I define it in the jenkins GUI:这是我在 jenkins GUI 中定义它的方式:

在此处输入图像描述

What am I missing?我错过了什么?

The only problem you have is the name attribute of the select should be hard-coded to value .您遇到的唯一问题是selectname属性应该硬编码为value no need for the id attribute.不需要id属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Jenkins Active Choices反应参考参数不适用于格式化的HTML输入文本框 - Jenkins Active Choices Reactive Reference Parameter does not work with Formatted HTML Input-Text-Box Jenkins - 如何处理主动选择反应参考参数中的复选框 - Jenkins - How to handle checkbox in Active choice reactive reference parameter HTML中的下拉选择列表的参数值 - Parameter value for an drop down select list in html Jenkins 参数值不显示 - Jenkins parameter value not displaying 改变价值 <p> 基于两个 <select>选择 - Change value of <p> based on two <select> choices 如何使用 html select 处理反应式表单? - How to Handle reactive forms with html select? html传递参数以形成并在选择框中自动选择一个值 - html passing parameter to form and auto-selecting a value in the select box 使用 javascript 代码从 HTML 的 select 标记中读取所选值 - read selected value from select tag of HTML using javascript code 从发送活动参数<select>在网址中 - sending active parameter from <select> in URL 带有html的html表单选择选项,以保持选定值处于活动状态“注意未定义的索引” - html form select option with php to keep selected value active “notice undefined index”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM