You could change your code to be...
<cfif frmVar EQ menuitemID>
<cfset counter = counter + 1>
</cfif>
HTH
-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 17:29
To: CF-Talk
Subject: RE: form variables in structures
Hi Mike,
Another question to see if anyone can help.
I want to count the total value of some dynamic variables, but only
particular ones. I am selecting which ones from a query, then outputting
the results and looping through the Form collection. However, my counter
never seems to display, and this code doesn't work. Can you see why?
<cfquery name="getmaincourses" datasource="#Request.App.dsn#">
SELECT *
FROM tbl_menuitems
WHERE venueID = #venue#
AND courseID = 3
</cfquery>
<!--- initialise counter --->
<cfset counter = 0>
<!--- output query, checking if a main course was selected and if it was
then adding the value of it to the counter --->
<cfoutput query="getmaincourses">
<CFLOOP COLLECTION="#FORM#" ITEM="frmVar">
<cfif frmVar IS "#menuitemID#">
<cfset counter = #counter# + #Form[frmVar]#>
</cfif>
</cfloop>
</cfoutput>
<cfif counter NEQ Form.noofdiners>
Not the same
<cfelseif counter EQ Form.noofdiners>
The same
</cfif>
but I get this error:
An error occurred while evaluating the expression:
counter = #counter# + #Form[frmVar]#
Error near line 52, column 9.
------------------------------------------------------------------------
----
----
Cannot convert to number.
Cheers
Will
-----Original Message-----
From: Mike Townend [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 12:54
To: CF-Talk
Subject: RE: form variables in structures
<CFLOOP COLLECTION="#FORM#" ITEM="frmVar">
<CFOUTPUT>
#frmVar# = #FORM[frmVar]#<br>
</CFOUTPUT>
</CFLOOP>
HTH
-----Original Message-----
From: Will Swain [mailto:[EMAIL PROTECTED]]
Sent: 06 March 2002 12:51
To: CF-Talk
Subject: form variables in structures
Hi,
I have a dynamic form that has a number of dynamic fields. I know that
Form variables are passed as a structure, but how would I access this. I
need to loop over the fields and display their values. Can any of you
guys help?
Cheers
Will
______________________________________________________________________
Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
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