dpFourOFour
dpFourOFour

Reputation: 1

Jenkins Jelly select does not save selected option

I'm using the following lines in my config.jelly

<f:entry title="${%Report file extension}" field="ReportExtension">
    <select name="ReportBuilder.ReportExtension" selected = "${instance.ReportExtension}">
        <option value="log" selected="${instance.ReportExtension=='log'}">log</option>
        <option value="html" selected="${instance.ReportExtension=='html'}">html</option>               
    </select>
</f:entry>

If i change the value in a Jenkis Job and run the job afterwards, the correct value is used, but if I edit the Job again, the selection was not saved and the default value is stored again.

Has anyone seen this before? I tried several different approaches I've found but I was not able to get it working.

Upvotes: 0

Views: 1845

Answers (1)

Suresh
Suresh

Reputation: 750

Try with the below code, simply returning true or false doesn't work. You have to return strings 'true' or 'false'.

<f:entry title="${%Report file extension}" field="ReportExtension">
<select name="ReportBuilder.ReportExtension" >
    <option value="log" selected="${instance.ReportExtension.equals('log')? 'true':null}">log</option>
    <option value="html" selected="${instance.ReportExtension.equals('html')? 'true':null}">html</option>               
</select>

Upvotes: 5

Related Questions