DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=36626>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=36626

           Summary: input:select options has key and value reversed
           Product: Taglibs
           Version: unspecified
          Platform: Macintosh
        OS/Version: Mac OS X 10.3
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Input Taglib
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


When using a LinkedHashMap to populate the <option> tags with the "options" 
parameter I expected 
the value in the key->value pair to appear between the <option> tags.  
Basically I would expect to see 
the longer, more descriptive, string appear in the pull down list. the <option 
value="key"> is where I 
would expect the HashMap's key to appear since this is the shorter, more 
concise string I will want to 
store and/or use in calculations.

I know it is a bit of a misnomer, since the option tag calls it a "value" but 
what I would really like there 
is the item you are calling the "label"

So if I was to pass in the following LinkedHashMap:

LinkedHashMap map = new LinkedHashMap(3);
map.put("1", "one");
map.put("2", "two");
map.put("3", "three");

<input:select name="number" options="<%= map %> />

I would expect it to generate the following HTML:

<select>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>

If this is just a matter of opinion, it would be great to have a switch that 
allowed me to determine 
whether the value or the key gets displayed in the list with the other stored 
as the option value.

The code that handles this seems to be in the Select.java file, the 
outputOption method around line 
205.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to