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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select option firing without a submit

Status
Not open for further replies.

nybz

Programmer
Mar 18, 2004
19
0
0
US
I would like the user to 'drive' the next page load by selecting an option - without having to press a submit button. I think the 'onChange' attribute makes sense, but I don't know how to implement. The target is a Java servlet.
 
Try something like this. It will get the value from the drop-down and pass it to the next page for retrieval from the querystring. Its all Javascript.

Code:
<html><head>
	<title></title>
</head><body>

<script language="javascript">

function goToNextPage ()
{
	document.location.href = "theNextPage.asp?passedvalue=" + document.frmMain.lstOptions.value;
}
</script>

<form name="frmMain">

	<select id="lstOptions" onchange="goToNextPage ();">
		<option value="1">1</option>
		<option value="2">2</option>
	</select>

</form>

</body></html>

- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top