Multi Select List box

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Multi Select List box

    Hi, I'm hoping someone can help. I have a dynamic multiselect menu. When a
    user selects more than one of the options, I am trying to pass in the multiple
    values into a recordset variable. I can pass in a normal dropdown listbox as
    a variable but how do I use multiple values in a where statement. select *
    from user where user_id in ('Parameter') Any help is much appreciated. Thanks
    Con

    greekchild Guest

  2. Similar Questions and Discussions

    1. List Component - Multi-select retrieve data
      Hey there, I'm having trouble retrieving the value of a multi-select list component. It always traces the last value selected, but I need to...
    2. multi table select
      I have two tables - table1 and table2. Their structures are identical and contain a column called status (an integer to store http response status...
    3. Multi-line TextBox - Paste text with numbered list, bullet list, tab character
      Hi All, I need a server control that's exactly like a multi-line TextBox, but also allow users to paste text with numbered list, bullet list, and...
    4. Select a list of items into an aliased field when doinga select
      OK I know this is going to sound weird, but I'm wondering if this is possible. I have a task table. (tblTask) These tasks can be assigned to...
    5. multi-select box validation
      Hi folks. I'm porting a cf site to php, everything's going very well, I like php much better (this, of course, being the correct forum to make...
  3. #2

    Default Re: Multi Select List box

    Are the values you are passing numeric or text-based?

    Best regards,
    Chris


    Chris In Madison Guest

  4. #3

    Default Re: Multi Select List box

    Hi Chris,

    The values I am passing are numeric. The menu list value is an id and the lable is text.

    Thanks

    Con
    greekchild Guest

  5. #4

    Default Re: Multi Select List box

    Then this should be pretty easy. Not sure which server model you're using,
    but I'm going to do this in ASP in this example.

    When you create your recordset definition, create a parameter with any name
    you like ("intUserList" for example). Then, for the default value, use -1
    or something you know won't return any values, and for the Run-Time Value,
    use Request("name_of_list_box").

    For your query use:

    select * from user where user_id in (intUserList)

    Dreamweaver should fix up the query so the resultant code will look like
    this:

    "select * from user where user_id in (" +
    Replace(Request("name_of_list_box"), "'", "''") + ")"

    So, if you select only one item in your list box, the resultant SQL would be
    (for example)::

    select * from user where user_id in (2)

    And if you select more than one item, the resultant SQL would be (for
    example):

    select * from user where user_id in (2, 4, 6, 8)

    That should do the trick (hopefully!)

    Best regards,
    Chris


    Chris In Madison Guest

  6. #5

    Default Re: Multi Select List box

    Hi, Thanks for the reponse but unfortunately it didn't work. Request('listbox')
    won't work so I tried request.form('listbox') and
    request.querystring('listbox') It only does the sql statement with the first
    option you select in the listbox. e.g if you select 3 items it still only adds
    1 in the sql statement. Cheers

    greekchild Guest

  7. #6

    Default Re: Multi Select List box

    really? That's weird...

    Let me do some tests and I'll get back with you...

    ~Chris


    Chris In Madison Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139