This is another approach I've used. Since there's a pattern to the
names, I just reReplace out the fields we're trying to count from
form.fieldNames and take the difference.
<cfset count = listLen(form.FieldNames) -
listLen(reReplaceNoCase(form.fieldNames, "headlined_[0-9]+,*", "",
"all"))>
-joe
----- Original Message -----
From: Raymond Camden <[EMAIL PROTECTED]>
Date: Fri, 13 Aug 2004 13:07:09 -0500
Subject: Re: Dynamic Form Element
To: CF-Talk <[EMAIL PROTECTED]>
You certainly do not need to do any of the below.
Items in the Form scope are treated like a structure. To get all the
fields, you can use structKeyList(). You can also use form.fieldnames,
a built in list of form fields.
To get the value, you use struct notation. Assume "key" is one form
field. The value can be retrieved like so:
form[key]
So all you need to do is loop through and examine fields that begin
with HEADLINEID.
On Fri, 13 Aug 2004 12:47:48 -0500, brobborb <[EMAIL PROTECTED]> wrote:
> First off, on that page, make a hidden field, name it like
num_heads, and give it the value of the number of headlineid forms.
>
> Then on the action page, which I am sure you will be using a loop,
you can access each of those forms. You will use the evaluate
function to access the form variables.
>
> <CFLOOP index = "num" from=1 to="#form.num_heads#">
> <CFSET temp = evaluate("form.headlined_" & form.num_heads)>
>
> <--- Then do stuff with temp then the loop starts over again to
the next form.--->
>
> </CFLOOP>
>
> I'm sure there's a betetr way tho ehehe.
>
> ----- Original Message -----
> From: Asim Manzur
> To: CF-Talk
> Sent: Friday, August 13, 2004 12:39 PM
> Subject: Dynamic Form Element
>
> A quick question.
>
> I have dynamic form fields like
> HEADLINEID_1
> HEADLINEID_2
> HEADLINEID_3
> HEADLINEID_4
>
> how can I count those in the action page.
> Also there are so many more fields are also getting submitted so,
I can't use StructCount()
>
> I need something like I can specify that count that mactched headlineID_*
>
> Regards,
>
>________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

