473,405 Members | 2,210 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,405 software developers and data experts.

How can I access an HTML form field in CF when I need to use a loop index variable?

So I have a form that has an array passed in. When generating the online form, I loop through the array and create the same text boxes for each value in the array. So my text boxes (relating to landscaping) have names like mow1 for the first array value, mow2 for the second, etc. When I submit the form I need to loop through the form fields in my cf code, to send each mini-form to a stored procedure that saves teh values in a database. Below is some code (with just one field as an example) of what I need to do. For the form field I need to capture the value of form.mow1, form.mow2, etc., but I can't get it to accept the form name using the index value of i added to the name. Is there a way to reference that form field differently that would let me concatenate the index number of i to the name, so it could read teh value corrctly? I will appreciate any help I can get on this one. Thanks.

Expand|Select|Wrap|Line Numbers
  1. <cfloop index="i" from="1" to="#ArrayLen(storeArr)#">
  2.  <cfscript>
  3.   StoredProc.createProcedure("sp_inst_landscaping");
  4.   StoredProc.addINParameter("CF_SQL_NUMERIC",form.mow&i,0);
  5.   StoredProc.executeProcedure();
  6.  </cfscript>    
  7. </cfloop>
Dec 29 '10 #1
1 2264
acoder
16,027 Expert Mod 8TB
You can use something like form["mow" & i]
Jan 14 '11 #2

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

Similar topics

0
by: Jason | last post by:
Currently I have a number of html forms which loop through records in a database table. In order to be able to update the right record when the form is submitted, I've tacked number on to the...
7
by: JDS | last post by:
Hi, all. I'd like to do the following, preferably *without* resorting to JavaScript: I have a long, dynamically-generated form questionnaire. Not all of the form fields are dynamically...
1
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in...
0
by: Rob Mau | last post by:
We are using Doc-to-Help 6.5 to produce HTML 1.x help for a Visual Studio.Net Windows application. We want the Help files to remain on our Intranet server. In my VS.Net project I've added a...
3
by: zeroDoNotYeSpamtype | last post by:
(I tried to post this earlier, but it seems without success) A similar question to this has been answered many times, to whit the question applying when the index variable of a for loop is...
0
by: g_k_harrison | last post by:
Hi. I've been at this database all day so this may come out muddled. I have MS Access 2000 in which I have a form with a several fields in which dollar amounts are entered. It's like this:
1
by: Coladude | last post by:
Hi, I´m building a form and decided to throw myself at some Javascript, even though im definetely no expert. Thats why i now need help :-/ I´m building a fairly simple HTML form where the user...
10
by: Kelly | last post by:
Can anyone tell me what I'm doing wrong here? ================================== <html> <head> <title>Test Form</title> <script language="JavaScript" type="text/javascript"> </head>
10
by: vladimirblotan | last post by:
Hi, I'm trying to create a dynamic form that is accessed from multiple pages. I've created the form and included into one of the main PHP pages using the include() function. Now, when I run...
3
by: parrib1 | last post by:
Dim formItemS As String, ParmString As String ParmString = "TelephoneNum1" formItemS = Forms!frmMacRequestsInputAdd!TelephoneNum1 Debug Results ? formItemS 5555555555 I want to do this and...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.