House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Talk (CF-Talk)

New at Structures

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Robert Orlini
05/17/2004 09:37 AM

I'm new at Structures...I wanted to add  variables to the "items" structure. The variables increment as they go thru a loop. The variable is called "qty" and as it goes thru the loop it would increment as "qty1", "qty2", etc thru a form. Here's the code. I'm having an obvious problem with the <CFSET items.qty#countlist#=qty(#countlist#)> which I know is not the right syntax... Any thoughts please? Thanks as always. Robert at HWW <CFIF isDefined("form.more.x")> <cfset countList = countList + 1> </cfif> <cfloop index="record" from="1" to="#countList#" step="1"> <form action="purchaseorder_Page_3.cfm" method="POST"> <input type="hidden" name="qty" value> <CFOUTPUT> <tr> <td width="25%" bgcolor="##FFEEB3" align="center"> <input type="text" name="qty" size="4"></td> </tr> </CFOUTPUT> <CFSET items=StructNew()> <CFIF IsDefined("qty#countlist#")> <CFSET items.qty#countlist#=qty(#countlist#)> </cfif> <cfoutput> #items.qty#countlist#<br> </cfoutput> </CFLOOP>

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Dave Watts
05/17/2004 09:49 AM

> I'm new at Structures...I wanted to add variables to the > "items" structure. The variables increment as they go thru > a loop. The variable is called "qty" and as it goes thru > the loop it would increment as "qty1", "qty2", etc thru a > form. Here's the code. I'm having an obvious problem with the > <CFSET items.qty#countlist#=qty(#countlist#)> which I know is > not the right syntax... You can use array syntax to reference your structure keys: <cfset items["qty#countlist#"] = ...> But I'm not sure exactly what you're trying to do with the rest of your code. Currently, you have two places where you're creating hidden form fields named "qty" within the same page, which probably won't give you the result you want. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ phone: 202-797-5496 fax: 202-797-5444


<< Previous Thread Today's Threads Next Thread >>

Search cf-talk

September 09, 2010

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30