I'll add one more solution to this.  The "form" scope in ColdFusion is
actually treated as a structure.  This means you can also find the
number of form fields by doing something like this:

#structCount(form)#

Realize, however, that this count will include the actual
"form.fieldnames" variable which doesn't truly get submitted by your
form, but rather gets calculated by ColdFusion and added to the FORM
scope/structure.  This means in order to get the count of just the
fields that were submitted, excluding "form.fieldnames", you'd need to
subtract one.

#evaluate(structCount(form)-1)#

Hope this helps,
Tyson

-----Original Message-----
From: Michael Wolter [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 09, 2001 8:34 AM
To: CF-Talk
Subject: counting form fields


Is there any way to get a count of the number of fields that are
returned
from a form?

Also, is there a way to get a count of the number of records selected by
a
cfquery?  The only way I have found to do that is to do a second cfquery
and use the "count(*)" function, but that seems to be double the work.
In Visual Basic, I can just put ".recordcount" after the recordset name
to
get a count.  Does Cold Fusion have anything like that?

Thanks!

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|  Michael Wolter 
                            [EMAIL PROTECTED]   |
|  Administrative Programmer/Analyst          Carlisle, PA 17013     |
|  Dickinson College, Computer Services       (717) 245-1527         |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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