Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I almost have this working... Pl

Status
Not open for further replies.
Jun 24, 2002
19
0
0
US
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=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<% Option Explicit %>
<%
Dim test_group, ptest_group
test_group = Request.Form(&quot;test_group&quot;)
ptest_group = Request(&quot;test_group&quot;)

If Request.Form(&quot;submit&quot;)= &quot;save&quot; Then
%>

test = <%Response.Write(test_group)%>
test_p = <%Response.Write Request(&quot;test_group&quot;)%>
one way = <%Response.Write(Request.Form(&quot;test_group&quot;).Count & &quot; tests were selected&quot;)
Else%>

<html>
<head>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Begin
function move(fbox,tbox) {
var i = 0;
if(fbox.value != &quot;&quot;) {
var no = new Option();
no.value = fbox.value;
no.text = fbox.value;
tbox.options[tbox.options.length] = no;
fbox.value = &quot;&quot;;
}
}
function remove(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options.selected && box.options != &quot;&quot;) {
box.options.value = &quot;&quot;;
box.options.text = &quot;&quot;;
}
}
BumpUp(box);
}
function BumpUp(abox) {
for(var i = 0; i < abox.options.length; i++) {
if(abox.options.value == &quot;&quot;) {
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 != &quot;&quot; && 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 != &quot;&quot; && 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=&quot;600&quot; border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr><td><form name=&quot;selectform&quot; action=&quot;add1.asp&quot; method=&quot;post&quot;></td></tr>
<tr><td colspan=&quot;3&quot;>Test Group:</td></tr>
<tr><td colspan=&quot;3&quot;><select name=&quot;test_group_select&quot;>
<option value=&quot;Test 1&quot;>Test 1</option>
<option value=&quot;Test 2&quot;>Test 2</option>
<option value=&quot;Test 3&quot;>Test 3</option>
<option value=&quot;Test 4&quot;>Test 4</option>
<option value=&quot;Test 5&quot;>Test 5</option>
<option value=&quot;Test 6&quot;>Test 6</option>
<option value=&quot;Test 7&quot;>Test 7</option>
<option value=&quot;Test 8&quot;>Test 8</option>
</select> <input type=&quot;button&quot; value=&quot;Add&quot; onclick=&quot;move(this.form.test_group_select,this.form.test_group)&quot; name=&quot;B1&quot;></td></tr>
<tr><td> </td></tr>
<tr><td><select multiple size=5 name=&quot;test_group&quot;></select></td>
<td> </td>
<td>
<input type=&quot;button&quot; value=&quot;Delete&quot; onClick=&quot;remove(this.form.test_group)&quot; name=&quot;B2&quot;>
<input type=&quot;button&quot; value=&quot;Up&quot; onClick=&quot;Moveup(this.form.test_group)&quot; name=&quot;B3&quot;>
<input type=&quot;button&quot; value=&quot;Down&quot; onClick=&quot;Movedown(this.form.test_group)&quot; name=&quot;B4&quot;>
<input type=&quot;submit&quot; value=&quot;save&quot; name=&quot;submit&quot; onsubmit=&quot;this.test_group.value=ln&quot;>

</td></tr>
</form>
</body>
</html>

<% End If %>



Bob C. I/T Department WYSAC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top