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
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