multiple select list - posting

Discussion in 'ASP General' started by Stephen Witter, Dec 20, 2003.

  1. I have a multiple select list and I am trying to post to a page where
    I have no option to use the request.form or vbscript to iterate
    through the control. The page is a sql server reporting services
    report. My question is, how can I populate a hidden textbox with
    multiple selected values of a select list

    1) without using two forms, one posting to populate the textbox with
    the list values, and

    2) one to post to the report.

    right now I am close using javascript:

    function onClick(object) {
    var allvals='';
    for (var Current=0;Current <
    object.MyList.options.length;Current++)
    {
    var text = object.MyTextBox ;
    var Mysite = "<%=strWebSite%>"
    if (object.MyList.options[Current].selected) {
    text.value = object.MyList.options[Current].text ;
    allvals=allvals + text.value + ',' ;
    }
    else {
    text.value = '';
    }
    } location.href= Mysite + '&MyList=' + allvals;
    }
    </SCRIPT>

    The only problem with this method is it returns a value like this:

    value1,value2,value3,

    I need:

    'value1','value2','value3'


    This will ultimately be used in a SQL "where in (values)" statement,
    which requires strings to have ' qualifiers. I can't figure out how
    too add the apostrophes and drop the last comma in javascript. I am
    no javascript pro and have scoured the ng looking for examples.

    any help is appreciated
    Stephen Witter, Dec 20, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. alanb
    Replies:
    2
    Views:
    519
    alanb
    Apr 23, 2004
  2. AmitKu
    Replies:
    7
    Views:
    499
    John Timney \(MVP\)
    Jan 8, 2007
  3. palmiere
    Replies:
    1
    Views:
    395
    Erwin Moller
    Feb 9, 2004
  4. Ferd Berfel
    Replies:
    4
    Views:
    147
  5. Replies:
    4
    Views:
    296
    Peter Michaux
    Nov 21, 2007
Loading...

Share This Page