Can I change the background of the blog?
Dynamic Form Element
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > ColdFusion > Dynamic Form Element 24 September 2008 03:52:07

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

Dynamic Form Element

Asim Manzur 24 September 2008 03:52:07
 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,

~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF community.
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=37

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:174225
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
Brobborb 13 August 2004 20:47:48 permanent link ]
 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.head­lined_" & 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,


~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
The annual ColdFusion User Conference is being held Sat 6/26 - Sun 6/27/04 8am-5pm in the Washington DC Area.
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=44

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:174227
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
Raymond Camden 13 August 2004 21:07:09 permanent link ]
 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 <brobborb-KWxODaeud­ppTGrOy2lmfZw@public­.gmane.org> 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.head­lined_" & 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,>

~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
Protect your mail server with built in anti-virus protection. It's not only good for you, it's good for everybody.
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=39

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:174229
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
Michael Tangorre 13 August 2004 21:14:26 permanent link ]
 I assume you can set a hidden form field (intHeaderCount) for the number
of HEADLINE_ID fields on the form page.

<cfif Len(Trim(form['intHeaderCount'])) GT 0>
<cfloop from="1" to="#form['intHeaderCount']#" index="x">
#form['HEADLINEID_' & x]#
</cfloop>
</cfif>

HTH,

Mike

~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
Sams Teach Yourself Regular Expressions in 10 Minutes by Ben Forta
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=40

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:174230
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
Joe Rinehart 13 August 2004 21:42:53 permanent link ]
 Hey Ray,

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.FieldN­ames) -
listLen(reReplaceNo­Case(form.fieldNames­, "headlined_[0-9]+,*", "",
"all"))>

-joe





----- Original Message -----
From: Raymond Camden <rcamden-Re5JQEeQqe­8AvxtiuMwx3w@public.­gmane.org>
Date: Fri, 13 Aug 2004 13:07:09 -0500
Subject: Re: Dynamic Form Element
To: CF-Talk <cf-talk-2K/2x8RPSj­9p9z4BATjFtQC/G2K4zD­Hf@public.gmane.org>­

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 <brobborb-KWxODaeud­ppTGrOy2lmfZw@public­.gmane.org> 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.head­lined_" & 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, >
__________________­______________


~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
Sams Teach Yourself Regular Expressions in 10 Minutes by Ben Forta
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=40

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:174238
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
Ewok 14 August 2004 02:25:07 permanent link ]
 you could loop form.fieldnames or the form collection and increment a counter if
FindNoCase("HEADLIN­EID_", index)
----- Original Message -----
From: Asim Manzur
To: CF-Talk
Sent: Friday, August 13, 2004 1: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,


~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF community.
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=38

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:174286
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > ColdFusion > Dynamic Form Element 24 September 2008 03:52:07

see also:
[PHP-DEV] PATCH Deprecated modules…
[PHP-DEV] development questions
[PHP-DEV] xmldoc() takes ages
пройди тесты:
see also:
Intellexer Spellchecker SDK
System error's blueprint
Bluetooth to be Buried?

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .