Reactive Reference: Display custom/dynamic UI parameter controls with dynamic HTML
Reactive Choices allow you to display dynamic HTML as a build form helper (reference) parameter. This has been quite enabling, but Active Choices v1.2 further enhances this functionality by allowing you to not only display custom/dynamic HTML controls, but also use their values as build parameters.
Required HTML Formatting
The value of a dynamic HTML control will be passed to the build as a parameter as long as the HTML element includes a name="value" attribute.
Using this feature you can add new types of UI controls to job forms to collect build parameter values. Another possible use case is changing the UI control type dynamically, depending on the context (incl. referenced parameter values). Eg. from 'select' to read only text input, when there's only one option, or to a warning message (without a value of course) when there's no option available.
Example: Add an Interactive Range Control to Build Forms
Here we demonstrate how to add a new sliding range control to adjust and display the radius of a circle. The value of the control will be passed to the build as a parameter.
The resulting build form is shown below:
Configuration: CircleRadius Active Choice Reactive Reference Parameter
Configuration: D3Circle Active Choice Reactive Reference Parameter
This parameter provides the required D3 java script that dynamically updates the range control label and draws a circle
The groovy script code that adds the java script functions to the build form is shown below
When the build starts the CircleRadius is passed and can be used as a parameter to the build. Note that the D3Cirle parameter is null which is the default behavior of a Reactive Reference parameter (used to display reference information but the value is not passed to the build)