I want to know how to read the DropDown list value from the JSP. Below is the code of my JSP.
<fieldset>
<s:form theme="simple" enctype="multipart/form-data" name="uploadDocument" method="POST" action="?">
<table>
<tr>
<td wrap>Select The Type of Letter to Upload:</td><td><s:select id="letters" list="letterList" name="ListofLetters" headerKey="-1" headerValue="--Select The Letter Type--"/></td>
<tr>
<td nowrap ><s:file name="userFile" label="userFile" size="25" id="upload" /></td>
<td class="button-blue"><s:submit action="Upload" value="Attach File" onclick=" return validateFile()"/></td>
</tr>
</table>
</s:form>
</fieldset>
where the list is populated dynamically from the Database.I wanted to know how to get the Dropdownlist value not the key.
Because when i used
document.getElementById('letters').value
It returns me the keyvalue like “0,1,2 etc” how can i get the value associated with the individual key so i can perform the proper check.
Thanks in Advance 🙂
Use this to get the currently selected option’s text:
Fiddle