ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 20th, 2004, 01:31 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
Question array output

i have an array defined as ProductID#i# which dynamically changes upon the results of the query.

on the processing page, how can i display the ProductID#i# ?

i tried
<cfloop from="1" to=".." index="i">
<cfoutput>#FORM.ProductID#i##</cfoutput>
</cfloop>

of course, CF didnt like it. what is the correct syntax to get this output?
thanks Kiteless for the previous posting. I will need to rethink and come up with a better structure. As you said, I need to let them update/delete so many records at the same time. They dont want to go back and forth all the time.
thanks ...

Reply With Quote
  #2  
Old October 20th, 2004, 01:55 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,648 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 8 m 8 sec
Reputation Power: 53
#form['productid#i#']#
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old October 20th, 2004, 02:15 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
thanks kiteless
but i am getting this error

Element Product1 is undefined in a Java object of type class coldfusion.filter.FormScope referenced as

i think something is wrong with my array decleration.

<select name="ProductID[#cZ#]" size="1" class="select">
<cfloop query="gZ">
<option value="#ZID#" <cfif #gZ.ZID# EQ ListGetAt(#FORM.ZoneID#, #cZ#)>SELECTED</cfif>>#ProductName#</option>
</cfloop>
</select>

i decided to have a select list and allow user to change it from a select. i defined cZ as a counter at the beginning of the page. I also defined
<cfset ProductID = ArrayNew(1)>

what am i doing wrong?

Reply With Quote
  #4  
Old October 20th, 2004, 02:39 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,648 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 8 m 8 sec
Reputation Power: 53
There isn't a form field with that name. Do a cfdump for the form scope to confirm that.

What is all that in the select box? This:

<select name="ProductID[#cZ#]" size="1" class="select">

Will end up creating a form field named something like:

ProductID[3]

Why are you doing that? Why not just do:

<select name="ProductID#cZ#" size="1" class="select">

Which would make:

ProductID3

?

Also, as far as I can tell, nothing you're doing has anything to do with arrays. Are you sure you understand arrays and what they are?

Reply With Quote
  #5  
Old October 20th, 2004, 02:58 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
i thought i understood the arrays.

here is an example what i want to do and this is how the form looks like

productname network avails date
----------- -------- ------ -----
selectlist1 CNN 2 1/1/2000
selectlist2 TNT 2 2/1/2000
selectlist3 NBC 2 3/1/2000

the form output changes every single time depending on what user selects from the previous page. so it can be 5 rows, or it can be 25. i want to assign every select/input to an array and on the processing page update the corresponding records.
i use
<cfform action="smt" method="post">
<cfloop query="something">
<cfoutput>
....
<select name="ProductID#cZ#">
....
</select>
...
</cfloop>
</cfoutput>
</cfform>

for every field in the cfform, i had to use unique names. that's why i tried adding a counter after the select/input names.
in essence i am trying to create an updateable cfgrid. the user can change/edit any area within that output. so i have to find a way to see what has been done to the form so that i can update the necessary fields. hope it makes sense.

Reply With Quote
  #6  
Old October 20th, 2004, 03:01 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,648 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 12 h 8 m 8 sec
Reputation Power: 53
No, it does make sense...if you do this:

<select name="ProductID#cZ#">
....
</select>

you'll get a form filed named something like "ProductID3".

Then on the target page you can reference it like this:

form['productid#i#']

Do a <cfdump var="#form#"> on the action page to confirm that the form fields have the names you expect.

And no, none of this has anything to do with arrays. Until you use the arrayNew() function you don't even have an array at all. Structures (which is what the FORM scope is) are similar to arrays in some ways, but they definitely are NOT the same so don't fall into that misconception.

Last edited by kiteless : October 20th, 2004 at 03:05 PM.

Reply With Quote
  #7  
Old October 20th, 2004, 03:27 PM
FALCONSEYE FALCONSEYE is offline
Permanently Banned
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 377 FALCONSEYE Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 1 Day 16 h 57 m 14 sec
Warnings Level: 15
Number of bans: 1
Reputation Power: 0
thanks <cf_kiteless>
it works fine for now
i kind of like using arrays for some reason. they feel cozy

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > array output


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway