So you need to process one or more formfields but you don't know the names at 
the time of processing? I had a similar requirement and here is how I solved it:


<cfscript>

   for(FormField in arguments.FormVars)   // this will loop through all 
available form variables
   {
    Quantity = structfind(arguments.FormVars, FormField);  // set the variable 
"quantity" to the value of the form variable
    if(left(FormField, 2) EQ "c_" and right(FormField, 14) NEQ "_cfforminteger" 
and len(Quantity))   // check if this is one of the form vars I actually want 
to process. The formvars with names that end in _cfforminteger are created by 
CFFORM and can be ignored
    {
     ConfigID = mid(FormField, 3, len(FormField));  // where I use "ItemID", 
you would use "InvoiceID"
    ... do something else...

    }
   }  
  </cfscript> 

The "trick" really is to prefix the fields you know you'll be interested in 
with something unique, like I did with "c_". Later, you can simply test for 
this.
Hope this makes sense.
Mischa.

BTW, I like CFScript, since it's a function, but you can write this is straight 
CF as well.





> Hey folks,

I was wondering if anyone had a solution to an issue I'm having that is 
resulting in some hair loss on my part by means of my hands.

I have a form that has repetitive fields that is built by using a loop.  

I append the form field name with a variable to distinguish between the 
different form fields: <CFINPUT TYPE="TEXT" NAME="InvAmt#InvoiceQuery.InvId#">. 
 This works fine for creating unique names for my form fields but it creates a 
problem when it's time to write to the db. 

I can't recreate the variable names in my SQL statement for the insert or 
update:

UPDATE tablename
 SET InvAmt = ??"InvAmt#InvoiceQuery.InvId#"??
 WHERE ID=#ID#

Obviously that won't work.

Any ideas on how I can create the variable name for my SQL statement or any 
other solutions to my problem?

Thanks,
Jeff

------------------------------------------------------------- 
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform 

For more info, see http://www.acfug.org/mailinglists 
Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink 
------------------------------------------------------------- <



Mischa Uppelschoten
The Banker's Exchange, Inc.
2020 Hills Avenue NW
Atlanta, GA  30318

Phone:    (404) 605-0100 ext. 10
Fax:    (404) 355-7930
Web:    www.BankersX.com
Follow this link for Instant Web Chat:
http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN



-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------



Reply via email to