Hello Techies,
I had created two combo boxes. After selection of first combo box the values are populated into second combo box.
But the problem is I am loosing the value which i selected in first combo box.
How can I get the value in the first combo box??
I tried with the following code.
<script language=”javascript”>
function selectApplication() {
alert(‘hi’);
var index = document.forms[0].applications.selectedIndex;
alert(index);
document.forms[0].hiddenName.value = index;
document.forms[0].submit();
}
function selectRuleSet() {
var index = document.forms[0].ruleSet.selectedIndex;
document.forms[0].hiddenName.value = index;
document.forms[0].submit();
}
function setSelectedComboIndex(){
alert(“seltSeletedComboIndex”);
var index = ‘<%request.getParameter(“hiddenName”);%>’;
alert(index);
document.forms[0].comboboxName.selectedIndex =index;
}
</script>
Here is jsp code.
<select name=”applications” >
<option value=””>application
<%
while(it.hasNext())
{
String applicationName = it.next().toString();
%>
<option value=”<%= applicationName %>”> <%= applicationName %>
<% } %>
</select>
<input type=”submit” onClick =”selectApplication()”>
Here setSelectedComboIndex() is not returning no value. I
can u guys tell what xactly I am missing.