PERFECT SOLUTION! Thanks Dave and everyone.
Here's what I ended up with:
<cfif isDefined("form.inputButton")>
<cfloop index="i" list="#form.fieldNames#">
<cfif #i# NEQ "inputButton">
<cfquery datasource="#dbname#" name="addContact">
INSERT INTO contact
(contactDbId,contactTypeId,contactDate)
VALUES ('#Evaluate(i)#','#form[i]#','#DateFormat(Now(),
'yyyy-mm-dd')#')
</cfquery>
</cfif>
</cfloop>
<cfelse>.......
-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Saturday, January 05, 2008 10:00 PM
To: CF-Talk
Subject: RE: using form.fieldNames and CFLOOP to insert selected radio
but tons
> > You can avoid this by using conditional logic within your loop to
> > exclude the fields you don't want, or by not giving those fields
> > names in the first place.
>
> I would really appreciate any concrete solutions/options/direction ...
I provided two solutions. They're about as concrete as you can get,
without me writing the code. Did you try either?
The first would involve wrapping your CFQUERY with CFIF tags:
<cfloop index="i" list="#form.fieldNames#">
<cfif i is not "inputbutton">
<cfquery datasource="#dbname#" name="addContact">
INSERT INTO contact
FIELDS (contactDbId,contactTypeId,contactDate)
VALUES (#Evaluate(i)#,#form[i]#,#DateFormat(Now(),
'yyyy-mm-dd')#)
</cfquery>
</cfif>
</cfloop>
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:295975
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4