How to set default value in Select dropdown in velocity template file?

479 views Asked by At

I am trying to build a custom build Jira Plugin, on the UI of plugin I am displaying select dropdown which consist of list of Issue Types.

I need to make option value "ALL" as default one for that select dropdown. I have written following code for that.

<label for="issue-types" >Issue Type(s):</label>
<select onchange="disableIfNoIssueTypeSelectedMandate()" class="multi-select" multiple="multiple" id="issue-types-mandate" name="issueTypes[]"> 
#foreach ($issueType in $allIssueTypesInProject)
<option value="$issueType.get("id")">$issueType.get("name")</option>
#end
</select>
</div>```

Can anyone please help me to know how to set default value in this select dropdown?
1

There are 1 answers

0
Ivan On

probably you should use <option selected="selected" value="$issueType.get("id")">$issueType.get("name") but with the default string values that you need