Professional Web Applications Themes

CFloop using List not working in MX7 - Coldfusion - Advanced Techniques

I am using the same code that worked fine in CFMX, and is now not working in MX7 when there are multiple selections being passed to an action page. If only 1 person is selected, the insert works fine in MX7. Has the cfloop code changed? My input page is passing a variable "componentpi" and when multile "componentpi"s are selected componentpi=132,5 is what is passed to the action page. My cfloop code is: <cfif #form.componentpi# Greater Than "0"> <cfloop index="compid" list="#form.componentpi#"> <cfquery name="insresearchpi" datasource="#DataSource#"> INSERT INTO researchpi (researchactivityid, componentpiid) values (#researchactivityid#,#compid#) </cfquery> </cfloop> </cfif>...

Sponsored Links
  1. #1

    Default CFloop using List not working in MX7

    I am using the same code that worked fine in CFMX, and is now not working in
    MX7 when there are multiple selections being passed to an action page. If only
    1 person is selected, the insert works fine in MX7. Has the cfloop code
    changed?

    My input page is passing a variable "componentpi" and when multile
    "componentpi"s are selected componentpi=132,5 is what is passed to the action
    page.

    My cfloop code is:

    <cfif #form.componentpi# Greater Than "0">
    <cfloop index="compid" list="#form.componentpi#">
    <cfquery name="insresearchpi" datasource="#DataSource#">
    INSERT INTO researchpi (researchactivityid, componentpiid)
    values (#researchactivityid#,#compid#)
    </cfquery>
    </cfloop>
    </cfif>

    Sponsored Links
    mauld Guest

  2. #2

    Default Re: CFloop using List not working in MX7

    Where does researchactivityid come from? Are you getting an error message? IF so, what is it? In your example, with componentpi=132,5, are two new records being created?
    jdeline Guest

  3. #3

    Default Re: CFloop using List not working in MX7

    researchactivityid is 5, that is being passed ok. Yes, there are suppose to be
    two records written, one with componentpi=132 and one with componentpi=5 with
    the researchactivityid=5 in both records. When you choose only one componentpi
    and the componentpi=132 is being passed, then the one record is written fine.
    When more than 1 id is passed, the cfloop/insert code does not even try to
    execute.

    mauld Guest

  4. #4

    Default Re: CFloop using List not working in MX7

    What does your de-bugging info say the value of form.componentpi is?

    Originally posted by: mauld
    researchactivityid is 5, that is being passed ok. Yes, there are suppose to
    be two records written, one with componentpi=132 and one with componentpi=5
    with the researchactivityid=5 in both records. When you choose only one
    componentpi and the componentpi=132 is being passed, then the one record is
    written fine. When more than 1 id is passed, the cfloop/insert code does not
    even try to execute.



    Dan Guest

  5. #5

    Default Re: CFloop using List not working in MX7

    COMPONENTPI=132,5

    mauld Guest

  6. #6

    Default Re: CFloop using List not working in MX7

    Mayhaps instead of this

    <cfif #form.componentpi# Greater Than "0">

    Use this

    <cfif listlen(form.componentpi)>
    JohnEric Guest

Similar Threads

  1. cfloop over a list - how to increment
    By willisman in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: July 1st, 01:55 PM
  2. Cfloop and list
    By jorgepino in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: June 29th, 03:06 PM
  3. CFLOOP not working for record insert as expected
    By kyle969 in forum Coldfusion - Advanced Techniques
    Replies: 3
    Last Post: May 9th, 07:59 PM
  4. just suggestion for working with list
    By T. Onoma in forum Ruby
    Replies: 1
    Last Post: November 21st, 08:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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