Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Coldfusion cfloop cfinput value

Posted on 2010-01-12
5
Medium Priority
?
433 Views
Last Modified: 2013-12-16
Ok so I have a form that I built with a cfloop and named the cfinput fields with the loop index ex....form.input#i#..... now I want to be able to add the value field to the cfinput tab....  so I would have <cfinput name=input#i# value=#form.input#i##> which is not correct...  How do I fix this issue?
0
Comment
Question by:clayo
  • 3
  • 2
5 Comments
 
LVL 53

Expert Comment

by:_agx_
ID: 26299525
Use array notation

ie
<cfinput name="input#i#" value="#form['input#i#']#" > or ...
<cfinput name="input#i#" value="#form['input'& i]#" >
0
 

Author Comment

by:clayo
ID: 26299541
I tried and still got an error here is the actual line <cfinput name="J#x#_Stunt_Diff" type="text" onChange="submit();" value="#form[J#x#_Stunt_Diff]#">
0
 
LVL 53

Expert Comment

by:_agx_
ID: 26299574
You forgot to use quotes around the field name portion. I'm not sure if "J" is a string or a variable, but try this

...        value="#form['J#x#_Stunt_Diff']#">


0
 

Author Comment

by:clayo
ID: 26299586
it returned this error message....  J is a string

Element J2_Stunt_Diff is undefined in a Java object of type class coldfusion.filter.FormScope.
0
 
LVL 53

Accepted Solution

by:
_agx_ earned 1000 total points
ID: 26299666
Well does it actually exist? FORM fields do not exist until you submit the form, in which case you'll get that error message.  You could use cfparam to set a default value. So it will always exist

<cfloop index="x" ... >
      <cfparam name="form.J#x#_Stunt_Diff" default="" />
</cfloop>
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question