Moving data between select boxes

Discussion in 'ASP General' started by Simon Finn, Oct 27, 2003.

  1. Simon Finn

    Simon Finn Guest


    I have used ASP code to load data into two select boxes. The code below is
    used to move the selected data back and forth between the boxes.

    I am having problems retreving the data from the boxes after the user has
    moved any of the data:

    If the data has been moved by the below code; when i try and load the data
    back into the database i cannot retrieve the data using:
    request.form("Clients1").item(1) and it will not show up using

    If i dont move the data i can retrieve it using:

    This is confusing me some what, any help would be great.

    Thanks Si.

    Here is my code:

    <FORM id="myForm" name="myForm" method="post" action="SaveITSkills.asp">
    <SELECT id=clients1 style="WIDTH: 160px; COLOR: black; HEIGHT: 266px"
    multiple size=5 name=clients1><%=optionStr%></SELECT>
    <INPUT onclick="moveIt('del',document.myForm.clients2.selectedIndex)"
    type=button value="Include" style="WIDTH: 61px; HEIGHT: 22px" size=51>
    <INPUT onclick="moveIt('add',document.myForm.clients1.selectedIndex)"
    type=button value="Exclude" style="WIDTH: 61px; HEIGHT: 22px" size=52>&nbsp;
    <SELECT id=clients2 style="WIDTH: 160px; COLOR: black; HEIGHT: 264px"
    multiple size=5 name=clients2><%=option2Str%></SELECT>
    <INPUT type=submit value=Save name=Save action="myform.submit();">
    <SCRIPT language=JavaScript>
    function moveIt(action, thisOption){
    if (thisOption == -1){
    return false;
    if (action == 'add'){
    c2 = document.getElementById("clients2")
    c2.options[c2.options.length] = new Option
    c1 = document.getElementById("clients1")
    c1.options[thisOption] = null
    if (action == 'del'){
    c1 = document.getElementById("clients1")
    c1.options[c1.options.length] = new Option
    c2 = document.getElementById("clients2")
    c2.options[thisOption] = null
    Simon Finn, Oct 27, 2003
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.