Multiple select of list boxes

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Multiple select of list boxes

    I am allowing my users to select multiple items in a list box, and I've set
    that up so it works swell. However, I'm unsure how to set each of the values
    selected into a Coldfusion variable. Do I need to use arrays? If so, how would
    I go about doing this with multiple selections from a listbox?

    FYI: Here's what my listbox looks like currently:

    <cfselect query="location" multiple="yes" size="5"
    name="Location" value="Location" selected="#SESSION.ProgWiz.Location#"/>

    Thanks,
    S./:confused;:|

    sage703 Guest

  2. Similar Questions and Discussions

    1. Dynamically Populate Multiple Select Boxes
      I am trying to develop an application where a user selects the Year, Make and Model of their vehicle. In the past, I had a query that input the...
    2. 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...
    3. multiple select list default values (asp/vb)
      (asp/vb) Hi all, I have a multiple select list on an insert record form. I can make multiple selections and insert them into the database...
    4. #25474 [Bgs]: posting arrays from a select box with multiple select is not working properly
      ID: 25474 User updated by: fmuller at cisco dot com -Summary: apache2filter: posting from a multiple select box is not...
    5. List Box Multiple Select Problem
      I am trying to create a drop down list that permits a person to select multiple items from the list and have the results posted on a results page. I...
  3. #2

    Default Re: Multiple select of list boxes

    You don't need arrays.
    CFSelect returns multiple values as a comma-seperated list.

    So the form's action page would see the variable FORM.Location and if multiple
    values were selected, FORM.Location's value might look like
    "Apple,Banana,Cherry".

    You could use <CFLOOP index="Fruit" List="#FORM.Location#"> to get at and
    process the selections.

    -- MikeR

    MikerRoo Guest

  4. #3

    Default Re: Multiple select of list boxes

    Ok, so in another segment of code (let's say on the session processing page), I
    could insert each of the values in the list into my table as separate records
    using code such as this:

    <cfif IsDefined("#SESSION.ProgWiz.Location#">
    <cfloop index=i loc_list="#SESSION.ProgWiz.Location#">
    <cfset index(i) = loc_list>
    </cfif>

    INSERT INTO <tablename>(
    <fieldname1>
    <fieldname2>
    etc...
    VALUES (
    <cfif index>
    index(i)
    </cfif>
    <fieldname2>
    etc....)

    That seems sort of right, but not quite (for example, i'll need to loop the
    index value in the INSERT statement so I can make multiple entries at once. Do
    you have any more useful tips Mike?

    S./


    sage703 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