473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I display dynamically named fields?

In my form I named the check boxes "chk_img_" & #i#.
So I get how to use it in IsDefined, but how do I get it to display the value of that FORM.check_img_1 without hard coding the number 1? Sometimes it might be like up to 1,000 and I'm not going to hard code a 1000000000 options. This is probabyl a very easy fix, but i've been up all night working on this code and now I'm dead in the water, with no brain power. Thanks in advance for the help.
Expand|Select|Wrap|Line Numbers
  1. <cfloop from="1" to="#intCheckBoxesCount#" index="i">
  2. <cfif IsDefined("FORM.chk_img_" & #i#)>
  3. <cfoutput>                    chk_img_#i# value = #FORM.check_img_#<!--- this is where i am having trouble --->
  4. </cfoutput>
  5. </cfif>
  6. </cfloop>
  7.  
Jul 15 '10 #1

✓ answered by acoder

You can use the form struct (if using POST):
Expand|Select|Wrap|Line Numbers
  1. form["chk_img_" & #i#]

4 2191
acoder
16,027 Expert Mod 8TB
You can use the form struct (if using POST):
Expand|Select|Wrap|Line Numbers
  1. form["chk_img_" & #i#]
Jul 15 '10 #2
@acoder
thanks, haha I've used it before. I don't know what I was/wasn't thinking
Jul 15 '10 #3
acoder
16,027 Expert Mod 8TB
Yes, it's easy to forget if not used often. Perhaps something to add to a "useful things easily forgotten" list :)
Jul 15 '10 #4
iohos
45
u cn cmbne text and vrble names to cnstrct a variable name on the left side of a cfset assgnmnt. e.g., d following code sets d value of d variable Product12 to the string "Widget":

<cfset ProdNo = 12>

<cfset "Product#ProdNo#" = "Widget">

To cnstrct a vrble name dis way, all the text on the left side of the equal sign must be in quotation marks.

dis usage is less efficient dan using arrays. The following example has the same purpose as the previous one, but requires less processing:

<cfset MyArray=ArrayNew(1)>

<cfset prodNo = 12>
<cfset myArray[prodNo] = "Widget">
Jul 25 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Darren Dale | last post by:
I am transitioning from Matlab and am not very literate in Python terminology.... I want to load data from a file, and I want to use the header to name my fields... for example, I have a file...
4
by: EmmettPower | last post by:
Hi, I have a form which includes a field 'number'. When 'number' is changed additional fields ('item_0', etc) are generated on the form using 'onchange'. I want to validate the form using...
1
by: | last post by:
In Actionscript 2.0 there is the concept of dynamically generating and naming objects at runtime. Dynamically named objects can be referenced and manipulated programmatically using array-access...
4
by: Stone Chen | last post by:
Hello, I have form that uses javascript createElement to add additional input fields to it. However, my validating script will not process new input fields because it can only find the named...
5
by: stellstarin | last post by:
I have a html where fields are created and added dynamically on the client side. I use the AppendChild() call to create fields dynamically. On submit i try to get the value for all the...
5
by: ogdenmd | last post by:
I want to give the user the abillity to add extra fields as needed. I've got it working in IE (surprsingly this works in IE but not in Firefox), however, basically I have an input field for a...
5
by: phpCodeHead | last post by:
I am needing to determine how to go about validating that a field in my form contains only a positive integer. I know that this is fairly simple if the form contains only one element to be...
0
by: bfrank1972 | last post by:
I want to be able to get a list of all custom named fields in an Excel worksheet, but I am having trouble with this. In the code below, access to a field that I named "DEALCODE" works fine - I get...
2
by: jennise | last post by:
Hello I am using the DoCmd.TransferText to write a macro to import dynamically named file from a filepath. My macro written as follows: Sub TestTransferText() DoCmd.TransferText...
1
by: Ayushi | last post by:
Hello, I have dynamically created fields in a gridview and bound the grid.But I am not able to access the cells in those fields.Can anybody help me out with this. Thankyou.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.