Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box :action on change and retaing values

Status
Not open for further replies.

shonJava

Programmer
Dec 27, 2004
11
US
Hi All,

I have two combo boxes combo1 and combo2, Combo1 is populated with list of values from database. Upon selecting value in combo1 iam calling javascrpit function which submits form and populates combo2. The problem is since the form is submitted the combo1's selected value is not retained ?, how can I retain the selected value by the user??
Also how can I call two diffrent actions on change diffrent combo boxes ??, any help is appreciated..
I tried this Javascript but this doen't work..
Code:
function populateConditions () {   
	document.forms[0].action = "/populateConditionTypes";
	document.forms[0].submit();
}
function populateConditionValues () {   
	document.forms[0].action = "/populateConditionValues";
	document.forms[0].submit();
}

Here is my actual code

Code:
function populateConditions () {   
	document.forms[0].submit();
}

function populateConditionValues () {   
	document.forms[0].submit();
}
       <html:select property="protocolsNames" size="1" onchange="populateConditions()">
	<%
		
       for(int i=0; i< protocols.length;i++){
		   
		   out.println("<option value="+ protocols[i].getId()+ " > " + protocols[i].getProtocolName() + "</option>");			
		}
	%>
      </html:select>

<html:select property="conditionTypes" size="1" onchange="populateConditionValues()">
	  <%
		
		if(protocolConditions !=null){
			for(int i=0; i< protocolConditions.length;i++){		   
				out.println("<option VALUE = " + protocolConditions[i].getId() + ">" + protocolConditions[i].getName() + "</option>");			
			}
		}
	%>
      </html:select>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top