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

Passing vales from drop down list to new page

Status
Not open for further replies.

Nazgulero

IS-IT--Management
Oct 24, 2003
45
0
0
NL
Hello all,

I posted this same problem a few days ago and got numerous useful hints, but I cannot seem to get this working:

Basically what I am doing is creating a drop down box using the script below. The result is two text fields; now I want to pass those values, which come from the drop down box, to the next page. The next page should then simply look like this:

Month:

Year:

And the values should be the ones from the drop-down box...
I have been staring myself blind about how to get this accomplished. Would be more than grateful if somebody could have a look...

<script language="JavaScript"><!--
function setForm2Value() {
var selectedItem = document.formName1.selectName1.selectedIndex;
var selectedItemValue = document.formName1.selectName1.options[selectedItem].value;
var selectedItemText = document.formName1.selectName1.options[selectedItem].text;

if (selectedItem != 0) {
document.formName2.textboxName1.value = selectedItemText;
document.formName2.textboxName2.value = selectedItemValue;
}
else {
document.formName2.textboxName1.value = "";
document.formName2.textboxName2.value = "";
}
}
//--></script>
Incident Level <br>
<form name="formName1">
<select name="selectName1" onChange="setForm2Value()">
<option>Make A Selection:
<option value="2000">January
<option value="2001">February
<option value="2002">March
</select>
</form>

<p>

<form name="formName2 action="page2.htm"">

<input type="text" name="textboxName1" value="" size="20">
<input type="text" name="textboxName2" value="" size="6">
</FORM>

Regards,

Naz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top