Problems with Listboxes

P

Paige_Franklin

I am trying to write a web page that allows a user to select things from box1
which then show up in box2. Box2 items need to be passed to the next page.
I cannot get this to pass the values of box2. Any help is appreciated - I am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length; counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false, false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem = document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false, false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH: 300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();" value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px" size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1" style="font-weight: 700">
<input type="reset" value="Reset" name="B2" style="font-weight: 700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>
 
K

Kevin Spencer

You have several problems. First, you're using Request.QueryString to read
the Request.Form Collection of the first page. Second, your second page is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select object is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
I am trying to write a web page that allows a user to select things from
box1
which then show up in box2. Box2 items need to be passed to the next
page.
I cannot get this to pass the values of box2. Any help is appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length; counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false, false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem = document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false, false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH: 300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();" value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1" style="font-weight:
700">
<input type="reset" value="Reset" name="B2" style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>
 
P

Paige_Franklin

Thank you! OK - after fixing the querystring problem. How do I create the
string to pass to the next page? I thought that is what selHospitals was
doing since that is the name of the second listbox...I thought I was creating
the field by making the value of it equal to the listbox.



Kevin Spencer said:
You have several problems. First, you're using Request.QueryString to read
the Request.Form Collection of the first page. Second, your second page is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select object is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
I am trying to write a web page that allows a user to select things from
box1
which then show up in box2. Box2 items need to be passed to the next
page.
I cannot get this to pass the values of box2. Any help is appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length; counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false, false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem = document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false, false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH: 300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();" value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1" style="font-weight:
700">
<input type="reset" value="Reset" name="B2" style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>

 
K

Kevin Spencer

To quote my Uncle Chutney:
if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select object
is
the selected value.


Please please please don't ask me to write the code for you!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
Thank you! OK - after fixing the querystring problem. How do I create
the
string to pass to the next page? I thought that is what selHospitals was
doing since that is the name of the second listbox...I thought I was
creating
the field by making the value of it equal to the listbox.



Kevin Spencer said:
You have several problems. First, you're using Request.QueryString to
read
the Request.Form Collection of the first page. Second, your second page
is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will have
to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select object
is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
I am trying to write a web page that allows a user to select things from
box1
which then show up in box2. Box2 items need to be passed to the next
page.
I cannot get this to pass the values of box2. Any help is
appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length;
counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false, false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem = document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false, false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH: 300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();"
value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1" style="font-weight:
700">
<input type="reset" value="Reset" name="B2" style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>

 
P

Paige_Franklin

OK - I thought this was a help forum. I'm not doing a school project here -
it's just a simple program and I'd like to get past this point so I can go on
and finish it - I've been struggling with this for the entire day and I was
hoping someone could help. If I knew HOW to populate the field I would do
it. Is there anyone else out there who can help me?

Kevin Spencer said:
To quote my Uncle Chutney:
if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select object
is
the selected value.


Please please please don't ask me to write the code for you!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Paige_Franklin said:
Thank you! OK - after fixing the querystring problem. How do I create
the
string to pass to the next page? I thought that is what selHospitals was
doing since that is the name of the second listbox...I thought I was
creating
the field by making the value of it equal to the listbox.



Kevin Spencer said:
You have several problems. First, you're using Request.QueryString to
read
the Request.Form Collection of the first page. Second, your second page
is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will have
to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select object
is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
I am trying to write a web page that allows a user to select things from
box1
which then show up in box2. Box2 items need to be passed to the next
page.
I cannot get this to pass the values of box2. Any help is
appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length;
counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false, false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem = document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false, false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH: 300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();"
value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1" style="font-weight:
700">
<input type="reset" value="Reset" name="B2" style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>

 
K

Kevin Spencer

OK - I thought this was a help forum.

It is a help forum. It's not a programmer-for-hire forum.

I did help you. In fact, I spent a long time slogging through your code to
figure out what was wrong with it, and writing a reply. I'm not doing anyone
any favors by spoon-feeding code to them. I pointed you in the right
direction. Now it's your turn to do some work.

Feed a man a fish and he eats for a day. Teach a man to fish and he eats for
life.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.


Paige_Franklin said:
OK - I thought this was a help forum. I'm not doing a school project
here -
it's just a simple program and I'd like to get past this point so I can go
on
and finish it - I've been struggling with this for the entire day and I
was
hoping someone could help. If I knew HOW to populate the field I would do
it. Is there anyone else out there who can help me?

Kevin Spencer said:
To quote my Uncle Chutney:
if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select
object
is
the selected value.


Please please please don't ask me to write the code for you!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
Thank you! OK - after fixing the querystring problem. How do I create
the
string to pass to the next page? I thought that is what selHospitals
was
doing since that is the name of the second listbox...I thought I was
creating
the field by making the value of it equal to the listbox.



:

You have several problems. First, you're using Request.QueryString to
read
the Request.Form Collection of the first page. Second, your second
page
is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will
have
to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select
object
is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
I am trying to write a web page that allows a user to select things
from
box1
which then show up in box2. Box2 items need to be passed to the
next
page.
I cannot get this to pass the values of box2. Any help is
appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length;
counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false,
false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem =
document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false,
false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH:
300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();"
value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1"
style="font-weight:
700">
<input type="reset" value="Reset" name="B2"
style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>

 
T

Tom Gahagan

Paige......

Do a google search on.....

Passing data with a url

The first page has several results that will show you what you need to do.

You have been helped here so don't look a gift horse in the mouth. (Not that
Kevin is a horse or anything!!) < vbg >

Now you've been helped a little more with another point in the right
direction. It is up to you to go and get it!

Best to you.......
Tom Gahagan

Paige_Franklin said:
OK - I thought this was a help forum. I'm not doing a school project
here -
it's just a simple program and I'd like to get past this point so I can go
on
and finish it - I've been struggling with this for the entire day and I
was
hoping someone could help. If I knew HOW to populate the field I would do
it. Is there anyone else out there who can help me?

Kevin Spencer said:
To quote my Uncle Chutney:
if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select
object
is
the selected value.


Please please please don't ask me to write the code for you!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
Thank you! OK - after fixing the querystring problem. How do I create
the
string to pass to the next page? I thought that is what selHospitals
was
doing since that is the name of the second listbox...I thought I was
creating
the field by making the value of it equal to the listbox.



:

You have several problems. First, you're using Request.QueryString to
read
the Request.Form Collection of the first page. Second, your second
page
is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will
have
to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select
object
is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
I am trying to write a web page that allows a user to select things
from
box1
which then show up in box2. Box2 items need to be passed to the
next
page.
I cannot get this to pass the values of box2. Any help is
appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length;
counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false,
false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem =
document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false,
false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH:
300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();"
value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1"
style="font-weight:
700">
<input type="reset" value="Reset" name="B2"
style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>

 
K

Kevin Spencer

You have been helped here so don't look a gift horse in the mouth. (Not
that Kevin is a horse or anything!!) < vbg >

You can lead a hrse to water, but you can't lead a horticulture.

--
;-),

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

Tom Gahagan said:
Paige......

Do a google search on.....

Passing data with a url

The first page has several results that will show you what you need to do.

You have been helped here so don't look a gift horse in the mouth. (Not
that Kevin is a horse or anything!!) < vbg >

Now you've been helped a little more with another point in the right
direction. It is up to you to go and get it!

Best to you.......
Tom Gahagan

Paige_Franklin said:
OK - I thought this was a help forum. I'm not doing a school project
here -
it's just a simple program and I'd like to get past this point so I can
go on
and finish it - I've been struggling with this for the entire day and I
was
hoping someone could help. If I knew HOW to populate the field I would
do
it. Is there anyone else out there who can help me?

Kevin Spencer said:
To quote my Uncle Chutney:

if you use the selHospitals form field, you will have to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all the
selected hospitals, as the only value that is passed from a select
object
is
the selected value.


Please please please don't ask me to write the code for you!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
Thank you! OK - after fixing the querystring problem. How do I
create
the
string to pass to the next page? I thought that is what selHospitals
was
doing since that is the name of the second listbox...I thought I was
creating
the field by making the value of it equal to the listbox.



:

You have several problems. First, you're using Request.QueryString to
read
the Request.Form Collection of the first page. Second, your second
page
is
referring to a hidden form field from the first page that is never
populated. Third, if you use the selHospitals form field, you will
have
to
either select all values from the list prior to submitting it, or
populate
the hidden form field with a comma-delimited string containing all
the
selected hospitals, as the only value that is passed from a select
object
is
the selected value.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

message
I am trying to write a web page that allows a user to select things
from
box1
which then show up in box2. Box2 items need to be passed to the
next
page.
I cannot get this to pass the values of box2. Any help is
appreciated - I
am
very new to .asp!

Prog1:
<%@ Language=VBScript %>
<HTML>
<HEAD>
<%Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>

<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Out";}
}
function document_onmouseover()
{if (top.event.srcElement.tagName == "BUTTON")
{top.event.srcElement.className = "Over";}
}
//-->
</script>
<script language="Javascript">
function addtocombo()
{
var i = 0
var selectedItem
var selectedText
var selectedValue
var newoption1

for (counter = 0; counter < userslist.hospitallist.length;
counter++)
{if (userslist.hospitallist.options(counter).selected == 1)
{selectedItem = document.userslist.hospitallist.selectedIndex;

selectedText =
document.userslist.hospitallist.options[counter].text;

selectedValue =
document.userslist.hospitallist.options[counter].value;

newoption1 = new Option(selectedText, selectedValue, false,
false);

document.userslist.selitems.options = newoption1;

i = i + 1}
}

}


function moveit()
{
var boxLength = document.userslist.selHospitals.length;
var selectedItem =
document.userslist.hospitallist1.selectedIndex;
var selectedText =
document.userslist.hospitallist1.options[selectedItem].text;
var selectedValue =
document.userslist.hospitallist1.options[selectedItem].value;
var i;
var isNew = true;


if (boxLength != 0)
{
for (i = 0; i < boxLength; i++)
{thisitem = document.userslist.selHospitals.options.text;
if (thisitem == selectedText)
{isNew = false;
break;}
}
}
if (isNew)
{ newoption = new Option(selectedText, selectedValue, false,
false);
document.userslist.selHospitals.options[boxLength] = newoption;}

document.userslist.hospitallist1.selectedIndex=-1;
}

function removefromcombo()
{ var boxLength = document.userslist.selHospitals.length;

arrSelected = new Array();

var count = 0;
for (i = 0; i < boxLength; i++)
{if (document.userslist.selHospitals.options.selected)
{arrSelected[count] =
document.userslist.selHospitals.options.value;}
count++;
}
var x;

for (i = 0; i < boxLength; i++)
{for (x = 0; x < arrSelected.length; x++)
{if (document.userslist.selHospitals.options.value ==
arrSelected[x])
{document.userslist.selHospitals.options = null;}
}
boxLength = document.userslist.selHospitals.length;
}
}

//-->
</script>
</HEAD>
<body>
<%
dim hospitallist1
dim selHospitals
%>

<center>
<b><font face="tahoma" size="4">Hospital Selection
List</font></b></center>
<hr>

<form name="userslist" method="GET" action="SelectTest.asp">

<center><table border="1" width="800" height="299">
<TR><TD width="200" bgcolor="#99ccff"> </TD>
<TD width="767"><b>Click on Name to Add</b><BR><HR>
<table><tr>
<td bgcolor="#cccccc" align="center"><b>Hospital List</b></td>
<td></td>
<td bgcolor="#cccccc" align="center"><b>User's Current Hospital
List</b></td></tr>
<tr> <td align="left">

<!-- onchange="moveit();" -->
<select name="hospitallist1" onchange="moveit();" style="WIDTH:
300px"
size="10" multiple>
<option value="9999">------ ALL HOSPITALS -----</option>
<option value="21028701">ARH Regional Medical Center</option>
<option value="21036501">Baptist Hospital East</option>
<option value="21037301">Baptist Hospital Northeast</option>
<option value="21008801">Baptist Regional Medical Center</option>
<option value="21005001">Berea Hospital</option>
<option value="21095001">Bluegrass Community Hospital</option>
<option value="21083401">Bourbon Community Hospital</option>
<option value="21026601">Breckinridge Memorial Hospital</option>
<option value="21087401">Caldwell County Hospital</option>
<option value="21062001">Caritas Medical Center</option>
<option value="21008101">Carroll County Hospital</option>
<option value="21710101">Casey County Hospital</option>
<option value="21905501">Caverna Memorial Hospital Inc.</option>

</select></td>
<!-- Remove Button -->
<%
Response.write "Hello"
%>
<td align="center">
<input type="button" tagName="BUTTON" onclick="removefromcombo();"
value="
< < Remove" id="submit2" name="submit2" style="FONT-WEIGHT:
bold"> </td>
<!-- Second List Box -->
<td align="left"><select name="selHospitals" style="WIDTH: 300px"
size="10"
multiple></select></td>
</tr>
</table> <p>

<input type=HIDDEN name="sHospitals" value="<%=selHospitals %>">
<input type="submit" value="Next>>" name="B1"
style="font-weight:
700">
<input type="reset" value="Reset" name="B2"
style="font-weight:
700">


<br>
</TD></TR>
</TABLE>
</CENTER>

</form>

</body>
</HTML>


Prog2:
<HTML>
<HEAD>
</HEAD>

<body>
<%
dim strHospitalList
dim whatislist


strHospitalList = (Request.querystring("sHospitals"))
whatislist = TypeName(strHospitalList)
Response.write "List = " & strHospitalList
%>

</body>
</HTML>

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top