|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ... |
|
#2
|
|||
|
|||
|
#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 |
|
#3
|
|||
|
|||
|
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? |
|
#4
|
|||
|
|||
|
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? |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
thanks <cf_kiteless>
it works fine for now i kind of like using arrays for some reason. they feel cozy ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > array output |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|