Javascript to enhance parameterized builds
Check out the Active Choices Plugin it does exactly what you're looking for:
jenkins-ci.org - Active Choices Plugin
github.com - Active Choices Plugin
A Jenkins UI plugin for generating and rendering multiple valueoptions for a job parameter. The parameter options can be dynamicallygenerated from a Groovy script and can respond to changes in other jobparameters. The value options can be rendered as combo-boxes,check-boxes, radio-buttons or rich HTML. Active Choices strives toprovide in a single plugin functionality found scattered among severalpre-existing plugins and some unique capabilities that are notavailable yet.
The Active Choices plug-in provides additional Jenkinsparameter types that can be rendered as user interface (UI) controlsin job forms.
Once the plugin is installed three new parameter types becomeavailable:
- Active Choices Parameter
- Active Choices Reactive Parameter
- Active Choices Reactive Reference Parameter
Active Choices parameters allow users to select value(s) for a job parameter. Parameter values can be:
- dynamically generated (using Groovy or a Scriptler script)
- dynamically updated based on other UI parameters
- multi-valued (can have more than one value)
- rendered with a variety of UI controls, including dynamic HTML
I think you would be able to accomplish your listed example with the following dynamic parameters plugin without using javascript: https://github.com/tekante/Dynamic-Jenkins-Parameter/wiki. I have not personally used the plugin as a disclaimer. It looks like it will probably need to be built first based on what I have seen in the GitHub repo and the fact that I cannot find it on the official Jenkins plugin page.