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