icepricessa
asked on
cant seem to get value out from form
Hi there I found this javascript and used it to create this select box where by the user can select what they want to delete. those that they have selected will be moved to the box on the right. However, the value does not seem to be passing over. How can I go about this? all help is greatly appreciated
[code]
<script language="Javascript">
<!--
function ClearList(OptionList, TitleName)
{ OptionList.length = 0;
}
function move(side)
{ var temp1 = new Array();
var temp2 = new Array();
var current1 = 0;
var current2 = 0;
var attribute;
//assign what select attribute treat as attribute1 & attribute2
if (side == "right")
{ attribute1 = document.selectBoxID.Box_N umber;
attribute2 = document.selectBoxID.Box_s elected;
}
else
{ attribute1 = document.selectBoxID.Box_s elected;
attribute2 = document.selectBoxID.Box_N umber;
}
//fill an array with old values
for (var i = 0; i < attribute2.length; i++)
{ temp1[current1++] = attribute2.options[i].valu e;
}
//assign new values to arrays
for (var i = 0; i < attribute1.length; i++)
{ if ( attribute1.options[i].sele cted )
{ temp1[current1++] = attribute1.options[i].valu e;
}
else
{ temp2[current2++] = attribute1.options[i].valu e;
}
}
//generating new options
for (var i = 0; i < temp1.length; i++)
{
attribute2.options[i] = new Option();
attribute2.options[i].valu e = temp1[i];
attribute2.options[i].text = temp1[i];
}
//generating new options
ClearList(attribute1,attri bute1);
if (temp2.length>0)
{
for (var i = 0; i < temp2.length; i++)
{ attribute1.options[i] = new Option();
attribute1.options[i].valu e = temp2[i];
attribute1.options[i].text = temp2[i];
}
}
}
//-->
</script>
[/code]
[code]
<table>
<tr>
<td>
<select name="Box_Number" id="Box_Number" multiple size="5" style="width=150px" width="150px">
<%
sql = "SELECT BoxID FROM Serial where PurchaseID="&purchase&" Group BY BoxID;"
Set RS = objConn.Execute(sql)
Do While not RS.EOF
%>
<option value="<%=RS("BoxID")%>">< %=RS("BoxI D")%></opt ion>
<%
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
%>
</select>
</td>
<td>
<input name="button" type="button" onclick="move('right')" value=">>">
<br>
<input name="button" type="button" onclick="move('left')" value="<<">
</td>
<td>
<select name="Box_selected" multiple size="5" style="width=150px" width="150px">
</select>
</td>
</tr>
</table>
[/code]
[code]
<script language="Javascript">
<!--
function ClearList(OptionList, TitleName)
{ OptionList.length = 0;
}
function move(side)
{ var temp1 = new Array();
var temp2 = new Array();
var current1 = 0;
var current2 = 0;
var attribute;
//assign what select attribute treat as attribute1 & attribute2
if (side == "right")
{ attribute1 = document.selectBoxID.Box_N
attribute2 = document.selectBoxID.Box_s
}
else
{ attribute1 = document.selectBoxID.Box_s
attribute2 = document.selectBoxID.Box_N
}
//fill an array with old values
for (var i = 0; i < attribute2.length; i++)
{ temp1[current1++] = attribute2.options[i].valu
}
//assign new values to arrays
for (var i = 0; i < attribute1.length; i++)
{ if ( attribute1.options[i].sele
{ temp1[current1++] = attribute1.options[i].valu
}
else
{ temp2[current2++] = attribute1.options[i].valu
}
}
//generating new options
for (var i = 0; i < temp1.length; i++)
{
attribute2.options[i] = new Option();
attribute2.options[i].valu
attribute2.options[i].text
}
//generating new options
ClearList(attribute1,attri
if (temp2.length>0)
{
for (var i = 0; i < temp2.length; i++)
{ attribute1.options[i] = new Option();
attribute1.options[i].valu
attribute1.options[i].text
}
}
}
//-->
</script>
[/code]
[code]
<table>
<tr>
<td>
<select name="Box_Number" id="Box_Number" multiple size="5" style="width=150px" width="150px">
<%
sql = "SELECT BoxID FROM Serial where PurchaseID="&purchase&" Group BY BoxID;"
Set RS = objConn.Execute(sql)
Do While not RS.EOF
%>
<option value="<%=RS("BoxID")%>"><
<%
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
%>
</select>
</td>
<td>
<input name="button" type="button" onclick="move('right')" value=">>">
<br>
<input name="button" type="button" onclick="move('left')" value="<<">
</td>
<td>
<select name="Box_selected" multiple size="5" style="width=150px" width="150px">
</select>
</td>
</tr>
</table>
[/code]
ASKER
hi there yes my form name is selectBoxID is there any way to get the values that are moved to the right box over to the next page?
ASKER
well... you see I have this form which the user would select from a dropdown box and that value would be passed over to the page which you see the code above.
at this page the user would select those numbers that are related to the value that was passed over to be deleted. in this case the value is purchase.
the javascript that I found simply moves the values from the left to the right. the ones that the user selects would be moved over to the right select box. the right side box is called Box_selected. I thought i could just get the Box_selected value after that, which doesnt seem to be the case. is it possible?
thanks :)
at this page the user would select those numbers that are related to the value that was passed over to be deleted. in this case the value is purchase.
the javascript that I found simply moves the values from the left to the right. the ones that the user selects would be moved over to the right select box. the right side box is called Box_selected. I thought i could just get the Box_selected value after that, which doesnt seem to be the case. is it possible?
thanks :)
Do you get problem in Javascript or posted form on the server side?
ASKER
the posted form on the server side.. somehow the value isnt geting passed over...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<form .... name="selectBoxID" ...>
If not, change the name in the javascript code.