use the evaule function.  in your loop, do this (lets say the counter is 
equal to 3)

#Evaluate('form.dateofbirth'& counter)#

coldfusion will read that as #form.dateofbirth3#




Pooh Bear
Web App Developer
Picture Below (chicks dig my head!)
<HTML>
<HEAD></HEAD>
<BODY>
<IMG SRC="http://www.geocities.com/kickerazn_2000/sniffles_138x92.jpg";>
</BODY>
</HTML>



>From: [EMAIL PROTECTED]
>Reply-To: [EMAIL PROTECTED]
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: Dynamic Fieldnames & database update
>Date: Wed, 29 Aug 2001 17:44:00 -0500
>
>
>I am working on a dynamic form that allows me to update multiple records at
>once.
>We use the primary key from the table as a hidden field to identify the
>record, and append a unique number to all fields from each record via a
>counter.
>For example, the form would look something like this
><cfloop>
>< input key#counter#> < input fieldname#counter#> < input 
>fieldname#counter#>
></cfloop>
>
>Problem is, when we go to update the database, how do we specify the
>formfields?  I'd assumed that we would need to loop over our counter again,
>but I don't know how to make the dynamic fieldnames in the update. How do I
>get coldfusion to recognize that I want #form.fieldname1# not
>"form.fieldname1" and not "value of fieldname1" the first time I loop over
>something like
>UPDATE interview
>SET ivr_key = '#form.fieldname##counter#'
>
>Any help would be appreciated!
>
>
>Here's the form so far:
><cfoutput>
><cfquery name="getinterviewdata" datasource="dsrc">
>      SELECT *
>      FROM interview INNER JOIN interviewer on interview.ivr_key =
>interviewer.ivr_key
>      WHERE interview.ivr_key = #cookie.interviewerid#
>      AND sch_name = '#cookie.schoolsession#'
></cfquery>
></cfoutput>
>
><CFQUERY name="getivrs" datasource="dsrc">
>      SELECT *
>      FROM Interviewer
></cfquery>
>
>
><table>
>      <tr>
>           <td><font face="Verdana" size="-1">Scheduled Interviews for
><cfoutput>#getinterviewdata.ivr_firstname#&nbsp;
>#getinterviewdata.ivr_lastname#</cfoutput></font><br>
>           <HR></td>
>      </tr>
></table>
>
><form name="UpdatedInterviewData" action="interviewedit_action.cfm" method
>="post">
>      <table cellspacing="0" cellpadding="0" width="90%">
>           <tr>
>                <td>
>                     <table border="1" bordercolor="Gray" cellspacing="0"
>cellpadding="0">
>                          <tr bgcolor="#FFFF80">
>                               <th width="20%">Interviewer</th>
>                               <th width="15%">Start Time</th>
>                               <th width="15%">End Time</th>
>                               <th width="15%">Location</th>
>                          </tr>
>                          <CFPARAM name="counter" default="0">
>                          <CFLOOP query="getinterviewdata">
>                          <tr>
>                          <CFSET counter = counter+1>
>                               <td align="center">
>                                    <select name="InterviewChange<cfoutput>
>#counter#</cfoutput>">
>                                          <cfoutput query="getivrs">
>                                               <option value="
>#getivrs.ivr_key#" <cfif isdefined("cookie.InterviewerID") and
>cookie.InterviewerID eq GetIvrs.ivr_key>selected</cfif>>
>#getivrs.ivr_FirstName#&nbsp;#getivrs.ivr_LastName#</option>
>                                          </cfoutput>
>                                    </select>
>                               </td>
>                               <cfoutput>
>                                    <td width="15%" align="center">
>#TimeFormat(getinterviewdata.int_StartTime, 'hh:mm tt')#</td>
>                                    <td width="15%" align="center">
>#TimeFormat(getinterviewdata.int_EndTime, 'hh:mm tt')#</td>
>                                    <td width="15%" align="center">
>#getinterviewdata.loc_Name#</td>
>                                    <input type="hidden" 
>name="intkey#counter#"
>value="#getinterviewdata.int_Code#">
>                               </cfoutput>
>                          </tr>
>                          </cfloop>
>                          <input type="hidden" name="counterfield" value
>="<cfoutput>#counter#</cfoutput>">
>                     </table>
>                </td>
>           </tr>
>
>      </table>
>      <table>
>           <tr>
>                <td><INPUT TYPE="submit" NAME="Submit" Value="Submit"></td>
>                <td><INPUT TYPE="reset" NAME="ResetForm" 
>Value="Reset"></td>
>           </tr>
>      </table>
></form>
>
>
>
>
>Thanks!
>Erica
>
>
>Erica Vitina
>Web Developer
>Abbott Laboratories
>[EMAIL PROTECTED]
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to