Reputation: 1617
I defined parameter of type "Active Choices Reactive Reference Parameter" on Freestyle Job
it returns HTML text input - <input>. but after populating this data and press "Build" i can't get the user input of this text field, tried with groovy or shell steps, for the parameter name itself i get empty string.
it's possible somehow to fetch the value of below field VAPP_ID ? suppose to get "123"
This is the groovy script of this Formatted HTML:
vappHtml = '''
<ul style="list-style-type: none">
<li>
<label for="VAPP_ID">VAPP_ID</label>
<input type="text" id="VAPP_ID" name="VAPP_ID">
</li>
</ul>
'''
return vappHtml
Upvotes: 5
Views: 10853
Reputation: 1
Ensuring name="value" is the only actual requirement. A class is not required. I recently had this same issue. It took me a long time to figure out why the input below would not return anything. "Job_Name" was my param name. That was also a problem. "Job_Name" is also a Jenkins param name (that you dont see). Your param names must be unique, and not overlap with any other env variables or they wont return anything.
BAD - Param name is "job_name"
<input type="text" id="Job_Name" name="value" value="">
GOOD - param name is "name"
<input type="text" id="Name" name="value" value="">
Upvotes: 0
Reputation: 1617
Finally i found what is the exact input definition needed to be able to fetch the data later in build steps.
groovy script:
vappHtml = '''
<ul style="list-style-type: none">
<li style="padding: 5px">
<label>VAPP_ID</label>
<input type="text" class="setting-input" name="value">
</li>
</ul>
'''
return vappHtml
How to actually fetch the data:
in build steps, like Shell, just get the original build parameter in my case it's $Env_Details
i was missing for 2 mandatory attributes for the <input>
Note - In case you want to use multiple input fields, just give all of them the same name attribute: name="value", in the result, it will just give you all the fields values separated by "," delimiter, so you can split it in groovy or something.
Hope it will help someone :)
Upvotes: 12