Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Default selection in select list - JIRA

b
Contributor
April 11, 2012

Hi,

I have class that extends JiraWebActionSupport and has String[] myUser instance variable. After not valid fill form I return to my view with form. And what I want is that all html control values have to have filled values. For example myUsers looks like:


<select id="myUsers" name="myUsers" multiple="multiple" class="select" size="6">
	#foreach ($user in $action.getAllUsers())
		  <option value="$user.name">$user.displayName ($user.emailAddress)</option>
	#end
</select>

But I don't want to make double loop and iterate over $user in $action.getAllUsers() and check if $user.name equal myUsers[i].

Is that possible?

4 answers

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2012

Or write your own method in your action class to do the same, probably easier.

0 votes
b
Contributor
April 11, 2012

myUser is an array, so there's no contains() method

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2012

ListTool might already be available somewhere, if not you can put it in the context...

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2012

> But I don't want to make double loop and iterate over $user in $action.getAllUsers() and check if $user.name equal myUsers[i].

Why don't use just use .contains() ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events