LyndonOHRC
Programmer
I want to save the contents of a dynamic dropdown to a variable so I can pass it to the action page of a form. I think I think I'm close but still missing something because the field "TheHiddenField" is empty when I get to the action page.
Thanks
Lyndon
Form:
Javascript:
Thanks
Lyndon
Form:
Code:
<form action="report.cfm" method="post" name="EmployeeReportForm">
<select name="list1" multiple size="10" onDblClick="LoadHiddenField()">
<option value="Matt">Matt</option>
<option value="Bob">Bob</option>
<option value="Bill">Bill</option>
</select>
<select name="list2" multiple size="10" onDblClick="LoadHiddenField()">
<option value="Mary">Mary</option>
<option value="Jane">Jane</option>
<option value="Sue">Sue</option>
</select>
<input type="Hidden" value="" name="TheHiddenField">
<input type="Submit" value="Print Preview">
</form>
Javascript:
Code:
function LoadHiddenField() {
var ListContents = "";
for ( var idx = 0; idx < document.EmployeeReportForm.list2.length; idx++ ) {
ListContents+=document.EmployeeReportForm.list2.options[idx].value&",";
}
document.EmployeeReportForm.TheHiddenField=ListContents;
}