Get the selected value from a Select box and check that value against an array in the same form
- by Rob Allen
I'm new to JSTL/EL and JSP and can't seem to find a reference which covers the following scenario:
I have an array of values in JavaScipt:
var Countries = ('US', 'CA');
I then need to check to see if the currently selected value of a standard HTML select box is in that array.
This is what I have so far:
<select id="shippingCountry">
<option value="AT">Austria</option>
<option value="CA">Canada</option>
<option value="DE">Germany</option>
//...
<option value="US">United States</option>
</select>
<c:choose>
<c:when test=" "> // I don't know what to put in the 'test' case
<span class="required">*</span>
</c:when>
</c:choose>