Hi, this is Bon from the Phil. I really need some help from some experts out there.
I have a form with two multiple select control (I named the first as cbo_source and the second as cbo_target). Once the form is loaded, the cbo_source loads all items from an MS Access database. Once i click the button >>, all the selected fields from the cbo_source should be transferred on the cbo_target control. Well, I'm done with that using javascript, my problem is how am i going to get all the items from the cbo_target control once i submitted the form? I can only get items that are selected on the cbo_target, but what i need is to get all items from the cbo_target regardless if it's selected or not.
Here is my code:
<%@ LANGUAGE="VBSCRIPT"%>
<%Option Explicit
dim cnn, rst,rs_client
dim str_names
Set cnn = Server.CreateObject("ADODB.Connection")
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Schedule_Dbase\QI_schedule.mdb;Mode=Read Write;Persist Security Info=False"
cnn.Open
Set rst = Server.CreateObject("ADODB.Recordset")
rst.ActiveConnection = cnn
rst.CursorType = 1
rst.LockType = 3
Set rs_client = Server.CreateObject("ADODB.Recordset")
rs_client.ActiveConnection = cnn
rs_client.CursorType = 1
rs_client.LockType = 3
%>
<
html>
<head>
<script LANGUAGE="vbscript">
<script type="text/javascript">
function mover(move)
<%Session("test") = "Bon"%>
{
var x = 0
if(move == 'remove')
{
for(x = 0;x<(document.frm_post.cboname_target.length);x++)
{
if(document.frm_post.cboname_target.options[x].selected)
{
with(document.frm_post.cboname_source)
{
options[options.length] = new Option(document.frm_post.cboname_target.options[x].text,document.frm_post.cboname_target.options[x].value);
}
document.frm_post.cboname_target.options[x] = null;
x = -1;
}
}
}
if(move == 'add')
{
for(x = 0;x<(document.frm_post.cboname_source.length);x++)
{
if(document.frm_post.cboname_source.options[x].selected)
{
with(document.frm_post.cboname_target)
{
options[options.length] = new Option(document.frm_post.cboname_source.options[x].text,document.frm_post.cboname_source.options[x].value);
}
document.frm_post.cboname_source.options[x] = null;
x = -1;
}
}
}
return true;
}
</script>
</head>
<form name="frm_post" method="POST" action="add_new_sched.
asp">
<select size="8" name="cboname_source" multiple>
<% rst.Open "SELECT * from tbl_Emp_Profile"
Do while rst.EOF = False %>
<option><%=rst("Name")%></option>
<%rst.movenext
Loop
%>
</select></font>
<input type="button" value=">>" name="cmdchoose" onclick="mover('add')">
<input type="button" value=" X " name="cmdremove" onclick="mover('remove')">
<select size="8" name="cboname_target" multiple>
<input type="submit" value="Submit" name="B1">
</form>
</
html>