OK Found it:
1..create a page called multipleSwapOnClick.asp (or what ever name you want) then paste the following code (it is cut n paste code):
-----------------------------------start----------------------------
<html>
<HEAD>
<title>Mulitiple swap on click</title>
<SCRIPT LANGUAGE="JavaScript">
function moveOver()
{
var boxLength = document.choiceForm.choiceBox.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText = document.choiceForm.available.options[selectedItem].text;
var selectedValue = document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.choiceBox.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.choiceBox.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
}
function removeMe() {
var boxLength = document.choiceForm.choiceBox.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.choiceForm.choiceBox.options[i].selected) {
arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
document.choiceForm.choiceBox.options[i] = null;
}
}
boxLength = document.choiceForm.choiceBox.length;
}
}
function saveMe() {
var strValues = "";
var boxLength = document.choiceForm.choiceBox.length;
var count = 0;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
if (count == 0) {
strValues = document.choiceForm.choiceBox.options[i].value;
}
else {
strValues = strValues + "," + document.choiceForm.choiceBox.options[i].value;
}
count++;
}
}
if (strValues.length == 0) {
alert("You have made no selection(s)");
}
else {
//alert("Here are the values you've selected:\r\n" + strValues);
choiceForm.valuesForInsert.value = strValues;
choiceForm.submit();
}
}
//// adminGroups multiple select swap code finish
function validate()
{
if(document.choiceForm.groupname.value=="")
{
alert("You must enter a group name");
document.choiceForm.groupname.focus();
return(false);
}
if(document.choiceForm.gDescription.value=="")
{
alert("Please enter a brief description, you may edit this anytime");
document.choiceForm.gDescription.focus();
return(false);
}
saveMe();
//return (true);
}
function groupValidate()
{
if(document.adminGroupsComments.suggestionString.v alue=="")
{
alert("You must enter a suggestion");
document.adminGroupsComments.suggestionString.focu s();
return(false);
}
return (true);
}
</script>
</HEAD>
<BODY>
<form name="choiceForm" action="getchosenSelections.asp" method="post">
<input type="hidden" name="selectedValues" value="0">
<input type="hidden" name="valuesForInsert" value="0">
<table border="0">
<tr>
<td valign="top" width=175>Available Countries:<br>
<select name="available" size=10 onchange="moveOver();">
<option value="1">Australia
<option value="2">New Zealand
<option value="3">USA
<option value="4">Canada
<option value="5">England
<option value="6">Switzerland
<option value="7">Russia
<option value="8">France
<option value="9">Italy
<option value="10">Samoa
</select></td>
<td valign="top">Your Choices:<input type="button" value="Remove" onclick="removeMe();"><br><select multiple name="choiceBox" style="width:150;" size="10"></select></td>
</tr>
<tr>
<td colspan=2><input type="button" value="Submit" onclick="saveMe();"></td>
</tr>
</table>
</form>
</body>
</html>
------------------------------------finish--------------------------
2..Now create a page at the same dir level called getchosenSelections.asp (must be called this unless you change the <form action=""> destination on the above page) Place the following code:
<%= request.form("valuesForInsert") %>
This gives you the ids/values of the unselected chosen selections in the form of a commer delimited string. Now split the commer delimited string on the commer and insert based on looping throught the array of values. I am assuming you dont need assistance with this part?
BTW On the page multipleSwapOnClick.asp uncomment the
JS on line 68 to show a
JS alert of the values you are about to post. It will alert, once you click OK it will post.
Wind is your friend
Matt