Announcement Announcement Module
Collapse
No announcement yet.
Interesting inconsistency in form tag with options and option Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Interesting inconsistency in form tag with options and option

    There are basically three ways to do a dropdown. If the myoptions[i].value is a space (ie I want the option in the dropdown to display as blank) the following results happen:

    Case 1:
    Code:
    <c:forEach items="${myoptions}" var="currOption" varStatus="status">
    	<form:option value="${currOption.key}">${currOption.value}</form:option>
    </c:forEach>
    result:
    Code:
    <select>
    	<option value="ID1">ID1</option>
    	<option value="ID2">ID2</option>
    </select>
    Case 2:
    Code:
    <c:forEach items="${myoptions}" var="currOption" varStatus="status">
    	<form:option value="${currOption.key}" label="${currOption.value}" />
    </c:forEach>
    result:
    Code:
    <select>
    	<option value="ID1"> </option>
    	<option value="ID2"> </option>
    </select>
    Case 3:
    Code:
    <form:options items="${myoptions}" itemValue="key" itemLabel="value" />
    result:
    Code:
    <select>
    	<option value="ID1"> </option>
    	<option value="ID2"> </option>
    </select>
    Because I can just add the label attribute and have it work the way I want it is no big deal. I was just wondering if anyone had some comments on why it works this way.
Working...
X