Update multiple rows on form submission

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

  1. #1

    Default Update multiple rows on form submission

    Dont know why my brain is farting on this but I need to update a table's rows
    after a form submission.

    Basically the table has the following CountryID, CountryName, CountryRate1,
    OnScroller.

    I Select all rows from the table and output 1 single form with each country on
    a line. Each line will allow you to edit the Name, and Rate values, as well as
    Check or Uncheck the Onscroller value.

    I'd like to be able to edit as many rows as I want and click "update".


    The "display" page uses a cfoutput query loop to generate:

    <cfoutput query="GetRates">
    <cfif CurrentRow MOD 2 IS 1><cfset bgcolor="##eeeeee"><cfelse><cfset
    bgcolor="##ffffff"></cfif>
    <tr bgcolor="#bgcolor#">
    <td><input type="text" name="CountryName" value="#CountryName#" size="40"
    style="background-color:#bgcolor#;"></td>
    <td align="center"><input type="text" name="CountryRate1"
    value="#CountryRate1#" size="7"></td>
    <td align="center">
    <cfif OnScroller EQ 1><input type="checkbox" name="OnScroller" value="1"
    checked>
    <cfelse><input type="checkbox" name="OnScroller" value="1">
    </cfif>
    </td>
    </tr>
    </cfoutput>

    The output looks great, how do I code the "update" page? I know I need to wrap
    this up in a loop somehow.

    Not sure how to set up the form variables and loop the update. Help?

    Chris

    Efused Guest

  2. Similar Questions and Discussions

    1. update multiple rows from one table
      Hi, I have a Dynamically created formfield. Tgis field shows the attached devices off a selected device (for instance you have a pc and in the...
    2. Update multiple rows data with a single button
      hello I have been trying to run multiple update queries based on the data entered by user. Brief background: I am fetching data from various...
    3. how can I update table with multiple rows
      Hi I have to output some data from cfquery into a table with text boxes. These text boxes are updatable . If multple rows are updated how can I...
    4. multiple form submission
      Can someone point me in the direction of a resource to learn how to submit multiple forms on a single page through a single submit button. The...
    5. Update multiple rows
      Been working with Access and SQL Server for a long time. New to Oracle. I have two tables TableA & TableB. TableA has EmployeeID (PK),Salary,...
  3. #2

    Default Re: Update multiple rows on form submission

    One way is to use a cfgrid and cfgridupdate, if it works with your particular
    database.

    Another way is to use dynamic formfield names when generating your form, and
    parse them out when processing it.

    So instead of name="countryname", have name = "countryname#currentrow#"

    There are a couple of recent threads regarding parsing the fieldnames when
    processing your form.

    Dan Bracuk 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