Reputation: 166
How can I know which radio button is selected in Jenkins?
My code example:
<f:section title="Select or upload application file">
<f:radioBlock checked="true" name="file" value="" title="Upload new version" inline="true">
<f:entry title="File Path" field="appFile">
<f:textbox/>
</f:entry>
<f:entry title="New Version" field="newVersion">
<f:textbox/>
</f:entry>
</f:radioBlock>
<f:radioBlock checked="false" name="file" value="" title="Available versions" inline="true">
<f:entry title="" field="oldVersion">
<f:select/>
</f:entry>
</f:radioBlock>
</f:section>
Upvotes: 0
Views: 3339
Reputation: 9075
A good place to start with this is to look for other plugins.
The jelly here looks like this
<f:radioBlock name="testToRun" value="BUILTIN_FUZZ" checked="${instance.isTestType('BUILTIN_FUZZ')}" title="Built-in Fuzz" inline="true">
<f:nested>
<f:entry title="Event Count" field="eventCount" description="[Optional] Number of fuzz events.">
<f:textbox/>
</f:entry>
<f:entry title="Event Throttle" field="eventThrottle" description="[Optional] Number for event throttle.">
<f:textbox/>
</f:entry>
<f:entry title="Seed" field="seed" description="[Optional] Seed to use for randomizing events.">
<f:textbox/>
</f:entry>
</f:nested>
</f:radioBlock>
which uses the function defined here
public String isTestType(String testTypeName) {
return this.testToRun.equalsIgnoreCase(testTypeName) ? "true" : "";
}
You need to bind the checked property to something in the instance
checked="${instance.isTestType('BUILTIN_FUZZ')}"
and have a public property on the class
public String testToRun;
and add that field into the DataBoundConstructor
@DataBoundConstructor
@SuppressWarnings("unused")
public AWSDeviceFarmRecorder(String projectName,
String devicePoolName,
String appArtifact,
String testToRun,
and you already have
inline="true"
so you don't have to add inner classes with its own DataBoundConstructor.
Upvotes: 2