For right now please help me correct this code, and hopefully I can apply it
to the actual updates...
cfloop from="1" to="#ListLen(form.EquipReqID)#" index="i">
<cfoutput><p align="center"> #ListGetAt(Form.EquipReqID,i)#:
#ListGetAt(Form.Comments,i)#</p></cfoutput>
</cfloop>
I appreciate any help I can get!
"DeniseELomax" <webfor...@macromedia.com> wrote in message news:cbpqmb$23a$1...@forums.macromedia.com...
Thanks.
On 6/30/04 11:56 PM, in article WHNEc.58885$E84.26179@edtnps89, "Kris
"Denise Lomax" <denis...@comcast.net> wrote in message news:BD107F0A.26CB%denis...@comcast.net...
Solution:
Instead of using the same name for the form-fields, append an index-number:
name="Comment_1", name="Comment_2", etc.
To find out the highest index, either loop over Form.FieldNames
="Comment_1,Comment_2, .." or loop
"while IsDefined("Form.Comment_#x#") ...
ISSUE:
When I try to output a form field that contains a variable, I don't
understand where to put the "#". By only putting the pound sign around the
variable, it sets the variable "CommentsV", to "Form.Comments1", not the
actual value of that field. (Note: The number of comments fields will vary
per form.)
INCORRECT CODE:
<cfloop index="i" from="1" to="#TotalCount#">
<cfset CountV = (#CountV# + 1)>
<CFIF IsDefined("Form.Comments#CountV#")>
<!-- HELP with this -->
<cfset CommentsV="Form.Comments#CountV#">
<cfoutput><p align="center"> #EquipReqIDV#</p></cfoutput>
</cfif>
</cfloop>
Thanks for your help.
On 7/7/04 3:12 AM, in article ccgeqc$4sd$1...@forums.macromedia.com, "Stefan
CORRECT CODE:
<cfloop index="i" from="1" to="#TotalCount#">
<cfset CountV = CountV + 1>
<!---
Why aren't you using the loop-variable "i"?
It counts up in steps of 1, perfect, unless CountV doesn't start at 1.
--->
<CFIF IsDefined("Form.Comments#CountV#")>
<!-- HELP with this -->
<cfset CommentsV= Form["Comments#CountV#"]>
<!---
The above uses array-notation.
The following is also widely used but not as good because using Evaluate:
<cfset CommentsV= Evaluate("Form.Comments#CountV#")>
--->
<cfoutput><p align="center"> #EquipReqIDV#</p></cfoutput>
<!---
I thought you wanted to output CommentsV, not "EquipReqIDV"?
<cfoutput><p align="center"> #CommentsV#</p></cfoutput>
--->
</cfif>
</cfloop>
OPTIMIZED CODE:
(may not be correct if other things influence your code)
<!--- try to minimize the amount of cfoutput, mostly once outside a loop,
rather then in loop where it gets executed for each loop-run --->
<cfoutput>
<cfloop index="CountV" from="1" to="#TotalCount#">
<!--- abort-loop condition, optional --->
<cfif not IsDefined("Form.Comments#CountV#")>
<cfbreak>
<!--- normal loop functionality --->
<cfelse>
<!---
I slightly adjusted the array notation here, mostly for readability then
performance, the
"Comments#CountV#"
becomes
"Comments" & CountV
which means "Comments" and the value of CountV by string-concatenation.
So #Form["Comments#CountV#"]# => #Form["Comments" & CountV]#
--->
<p align="center"> #Form["Comments" & CountV]#</p>
</cfif>
</cfloop>
</cfoutput>
OPTIMIZED CODE WITHOUT COMMENTS:
<cfoutput>
<cfloop index="CountV" from="1" to="#TotalCount#">
<cfif not IsDefined("Form.Comments#CountV#")>
<cfbreak>
<cfelse>
<p align="center"> #Form["Comments" & CountV]#</p>
</cfif>
</cfloop>
</cfoutput>
On 7/8/04 9:10 AM, in article ccjo4d$flt$1...@forums.macromedia.com, "Stefan
<cfset FormField1 = Replace(FormField1,",","|","ALL")>
And then you can use the FormField1 directly.
And then you can use it.
1. The form field contains multiple values which are comma-delimited by W3C
convention. One or more of the individual field contents contain one or more
literal commas, which throw off the comma-delimited scheme.
2. Issuing a simple REPLACE against the form field value will replace the
delimiters also, leaving you in the same boat as when you started.