I have created this JSP page in which all the drop down menus are populated from database. This functionality works fine I’ve tested it. But now I need to add a function so the third drop down menu (which is Forecast ISC) only becomes visible when I select a certain field from first menu which is “Type” .So far I haven’t created any java script because that’s what i need help with! Any suggestions or comment will help!
<form:form action="/analysis/analysisSummary" modelAttribute="shipData"
method="POST" onChange = 'checkType()'>
<br>
<table width="100%">
<tr>
<td width="20%"></td>
<td width="20%">Type:<form:select id="type" path="type">
<form:option value="All">------ All ------ </form:option>
<form:options items="${analysisEvents}" itemLabel="description"
itemValue="code" />
</form:select>
</td>
<td width="20%">Forecast ISC:<form:select id="iscCode"
path="iscCode">
<form:option value="All">ALL</form:option>
<form:options items="${iscCodes}" />
</form:select>
</td>
<td width="30%"><div style="visibility: hidden">
Actual ISC: <form:select id="sctry"
path="iscCode">
<form:option value="All">ALL</form:option>
<form:options items="${iscCodes}" />
</form:select>
</div>
</td>
HTML:
<form id="shipData" onChange="checkType()" action="/analysis/analysisSummary" method="POST">
<br>
<table width="100%">
<tr>
<td width="20%"></td>
<td width="20%">Type:<select id="type" name="type">
<option value="All">------ All ------</option>
<option value="U">Unanalyzed</option><option value="H">Pending</option><option value="F">True Hit</option><option value="C">Return Reason</option><option value="S">Parcel Returned</option><option value="T">Long Term Pending</option><option value="Z">Value >2500</option>
</select>
</td>
<td width="20%">Forecast ISC:<select id="iscCode" name="iscCode">
<option value="All">ALL</option>
<option value="JFK">JFK</option><option value="LAX">LAX</option><option value="MIA">MIA</option><option value="ORD">ORD</option><option value="SFO">SFO</option>
</select>
</td>
<td width="30%"><div style="visibility: hidden">
Actual ISC: <select id="sctry" name="iscCode">
<option value="All">ALL</option>
<option value="JFK">JFK</option><option value="LAX">LAX</option><option value="MIA">MIA</option><option value="ORD">ORD</option><option value="SFO">SFO</option>
</select>
</div>
</td>
<td width="8%"></td>
</tr>
</table>
<br>
<table width="100%">
<tr>
<td width="20%"></td>
For DEMO