Page code:
---------
<html:select property="projectId" styleClass="ctrlwidthfirstpair">
<html:options collection="projects" property="value" labelProperty="label" />
</html:select>
JavaScript:
function isProjectSelected() {
var selIndex = document.getElementById("projectId").selectedIndex;
if (selIndex == 0) {
alert("Please Select Project");
return false;
}
return true;
}
document.getElementById("projectId") returns null value.
How to get index of selected option of <html:select> component?
The attribute you're looking for is
styleId. Next time, try reading the fine manual.