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:
result:Code:<c:forEach items="${myoptions}" var="currOption" varStatus="status"> <form:option value="${currOption.key}">${currOption.value}</form:option> </c:forEach>
Case 2:Code:<select> <option value="ID1">ID1</option> <option value="ID2">ID2</option> </select>
result:Code:<c:forEach items="${myoptions}" var="currOption" varStatus="status"> <form:option value="${currOption.key}" label="${currOption.value}" /> </c:forEach>
Case 3:Code:<select> <option value="ID1"> </option> <option value="ID2"> </option> </select>
result:Code:<form:options items="${myoptions}" itemValue="key" itemLabel="value" />
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.Code:<select> <option value="ID1"> </option> <option value="ID2"> </option> </select>


Reply With Quote