bucephalushtml
Vendor
I almost have this working...
Please test this code... What you'll find is that in order to pass the selected tests on to the next page you have to "select" them in the second box. Is there a way to pass the variable values to the processing page without having to select them in the second box?
Thanks in advance...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<%
Dim test_group, ptest_group
test_group = Request.Form("test_group"
ptest_group = Request("test_group"
If Request.Form("submit"
= "save" Then
%>
test = <%Response.Write(test_group)%>
test_p = <%Response.Write Request("test_group"
%>
one way = <%Response.Write(Request.Form("test_group"
.Count & " tests were selected"
Else%>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function move(fbox,tbox) {
var i = 0;
if(fbox.value != ""
{
var no = new Option();
no.value = fbox.value;
no.text = fbox.value;
tbox.options[tbox.options.length] = no;
fbox.value = "";
}
}
function remove(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options.selected && box.options != ""
{
box.options.value = "";
box.options.text = "";
}
}
BumpUp(box);
}
function BumpUp(abox) {
for(var i = 0; i < abox.options.length; i++) {
if(abox.options.value == ""
{
for(var j = i; j < abox.options.length - 1; j++) {
abox.options[j].value = abox.options[j + 1].value;
abox.options[j].text = abox.options[j + 1].text;
}
var ln = i;
break;
}
}
if(ln < abox.options.length) {
abox.options.length -= 1;
BumpUp(abox);
}
}
function Moveup(dbox) {
for(var i = 0; i < dbox.options.length; i++) {
if (dbox.options.selected && dbox.options != "" && dbox.options != dbox.options[0]) {
var tmpval = dbox.options.value;
var tmpval2 = dbox.options.text;
dbox.options.value = dbox.options[i - 1].value;
dbox.options.text = dbox.options[i - 1].text
dbox.options[i-1].value = tmpval;
dbox.options[i-1].text = tmpval2;
}
}
}
function Movedown(ebox) {
for(var i = 0; i < ebox.options.length; i++) {
if (ebox.options.selected && ebox.options != "" && ebox.options[i+1] != ebox.options[ebox.options.length]) {
var tmpval = ebox.options.value;
var tmpval2 = ebox.options.text;
ebox.options.value = ebox.options[i+1].value;
ebox.options.text = ebox.options[i+1].text
ebox.options[i+1].value = tmpval;
ebox.options[i+1].text = tmpval2;
}
}
}
// End -->
</script>
</head>
<body>
<table width="600" border="1" cellspacing="0" cellpadding="0">
<tr><td><form name="selectform" action="add1.asp" method="post"></td></tr>
<tr><td colspan="3">Test Group:</td></tr>
<tr><td colspan="3"><select name="test_group_select">
<option value="Test 1">Test 1</option>
<option value="Test 2">Test 2</option>
<option value="Test 3">Test 3</option>
<option value="Test 4">Test 4</option>
<option value="Test 5">Test 5</option>
<option value="Test 6">Test 6</option>
<option value="Test 7">Test 7</option>
<option value="Test 8">Test 8</option>
</select> <input type="button" value="Add" onclick="move(this.form.test_group_select,this.form.test_group)" name="B1"></td></tr>
<tr><td> </td></tr>
<tr><td><select multiple size=5 name="test_group"></select></td>
<td> </td>
<td>
<input type="button" value="Delete" onClick="remove(this.form.test_group)" name="B2">
<input type="button" value="Up" onClick="Moveup(this.form.test_group)" name="B3">
<input type="button" value="Down" onClick="Movedown(this.form.test_group)" name="B4">
<input type="submit" value="save" name="submit" onsubmit="this.test_group.value=ln">
</td></tr>
</form>
</body>
</html>
<% End If %>
Bob C. I/T Department WYSAC
Please test this code... What you'll find is that in order to pass the selected tests on to the next page you have to "select" them in the second box. Is there a way to pass the variable values to the processing page without having to select them in the second box?
Thanks in advance...
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% Option Explicit %>
<%
Dim test_group, ptest_group
test_group = Request.Form("test_group"
ptest_group = Request("test_group"
If Request.Form("submit"
%>
test = <%Response.Write(test_group)%>
test_p = <%Response.Write Request("test_group"
one way = <%Response.Write(Request.Form("test_group"
Else%>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function move(fbox,tbox) {
var i = 0;
if(fbox.value != ""
var no = new Option();
no.value = fbox.value;
no.text = fbox.value;
tbox.options[tbox.options.length] = no;
fbox.value = "";
}
}
function remove(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options.selected && box.options != ""
box.options.value = "";
box.options.text = "";
}
}
BumpUp(box);
}
function BumpUp(abox) {
for(var i = 0; i < abox.options.length; i++) {
if(abox.options.value == ""
for(var j = i; j < abox.options.length - 1; j++) {
abox.options[j].value = abox.options[j + 1].value;
abox.options[j].text = abox.options[j + 1].text;
}
var ln = i;
break;
}
}
if(ln < abox.options.length) {
abox.options.length -= 1;
BumpUp(abox);
}
}
function Moveup(dbox) {
for(var i = 0; i < dbox.options.length; i++) {
if (dbox.options.selected && dbox.options != "" && dbox.options != dbox.options[0]) {
var tmpval = dbox.options.value;
var tmpval2 = dbox.options.text;
dbox.options.value = dbox.options[i - 1].value;
dbox.options.text = dbox.options[i - 1].text
dbox.options[i-1].value = tmpval;
dbox.options[i-1].text = tmpval2;
}
}
}
function Movedown(ebox) {
for(var i = 0; i < ebox.options.length; i++) {
if (ebox.options.selected && ebox.options != "" && ebox.options[i+1] != ebox.options[ebox.options.length]) {
var tmpval = ebox.options.value;
var tmpval2 = ebox.options.text;
ebox.options.value = ebox.options[i+1].value;
ebox.options.text = ebox.options[i+1].text
ebox.options[i+1].value = tmpval;
ebox.options[i+1].text = tmpval2;
}
}
}
// End -->
</script>
</head>
<body>
<table width="600" border="1" cellspacing="0" cellpadding="0">
<tr><td><form name="selectform" action="add1.asp" method="post"></td></tr>
<tr><td colspan="3">Test Group:</td></tr>
<tr><td colspan="3"><select name="test_group_select">
<option value="Test 1">Test 1</option>
<option value="Test 2">Test 2</option>
<option value="Test 3">Test 3</option>
<option value="Test 4">Test 4</option>
<option value="Test 5">Test 5</option>
<option value="Test 6">Test 6</option>
<option value="Test 7">Test 7</option>
<option value="Test 8">Test 8</option>
</select> <input type="button" value="Add" onclick="move(this.form.test_group_select,this.form.test_group)" name="B1"></td></tr>
<tr><td> </td></tr>
<tr><td><select multiple size=5 name="test_group"></select></td>
<td> </td>
<td>
<input type="button" value="Delete" onClick="remove(this.form.test_group)" name="B2">
<input type="button" value="Up" onClick="Moveup(this.form.test_group)" name="B3">
<input type="button" value="Down" onClick="Movedown(this.form.test_group)" name="B4">
<input type="submit" value="save" name="submit" onsubmit="this.test_group.value=ln">
</td></tr>
</form>
</body>
</html>
<% End If %>
Bob C. I/T Department WYSAC