i have two select input fields in a jsp page. i want to disable the second input based on the value of first input. i wrote the function. but it is not working, plz help.
function selectTimePeriod()
{
var rtype = document.getElementById('customer.customerType').value;
var corporateSize = document.getElementById("customer.corporateSize").value;
if(rtype == "PRS" )
{
document.getElementById("corporateClient").style.display = 'none';
document.getElementById("prjClient").style.display = 'none';
document.getElementById("prsClient").style.display = '';
corporateSize.disabled=true;
}
}
the input fields are:
<td>
<html:select property="customer.customerType" styleId="customer.customerType" onchange="selectTimePeriod()">
<%
for (index6 = 0; index6 < Constants.customerTypeConstants.length; index6++)
{
%>
<html:option value="<%=Constants.customerTypeConstants[index6][0]%>"><%=Constants.customerTypeConstants[index6][1]%></html:option>
<%
}
%>
</html:select>
</td>
</tr>
<tr >
<td><label class="desc"><bean:message key="label.customer.corporateSize"/></label></td>
<td>
<html:select property="customer.corporateSize" styleId="customer.corporateSize">
<%
for (index6 = 0; index6 < Constants.corporateSizeConstants.length; index6++)
{
%>
<html:option value="<%=Constants.corporateSizeConstants[index6][0]%>"><%=Constants.corporateSizeConstants[index6][1]%></html:option>
<%
}
%>
</html:select>
</td>