|
|
|
|
|
| | |
|
vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds
(Advanced)
(Components)
(Database)
(General)
(Vbscript)

|
|
Subject: |
Passing Array on submit of a form |
From: |
bigdog |
Date: |
1/29/2001 11:02:17 AM |
IP: |
198.166.214.4 |
Does anyone know how to pass a select array created with javascript with a form on the submit of the form? Here is the code I have on the page. The first list box is filled from the db and the second list box is filled when a person makes a selection from the first list box. I want to pass the all the items in the second listbox when the form is submitted.
This code creates the two select lists and fills the first one.
<TABLE BORDER=0 cellpadding=0 cellspacing=2 width=525>
<tr>
<td>
<br>
<b>Select Department: </b><br>
<select name="dept" size="10" onchange="moveOver();">
<%
while not (RS.EOF)
Response.Write ("<option value=" & QQ & RS("DeptNum") & QQ & ">" & RS("DeptName") & CRLF)
RS.MoveNext()
wend %>
</select></td>
<td><br>
<b>Departments: </b><br>
<select name="deptnum" size="10" width="265" multiple onchange="removeMe();">
</select></td></tr>
</table>
Here is the function to move selected items to the second listbox.
function moveOver()
{
var boxLength = document.DeptForm.deptnum.length;
var selectedItem = document.DeptForm.dept.selectedIndex;
var selectedText = document.DeptForm.dept.options[selectedItem].text;
var selectedValue = document.DeptForm.dept.options[selectedItem].value;
var i;
var isNew = true;
//loop through and test to see if the selected dept is a duplicate. If it is do nothing
if (boxLength != 0) {0 |
|
|

|
|
|
|
|
|
|
|
|
|