?
Solved

Coldfusion cfloop cfinput value

Posted on 2010-01-12
5
Medium Priority
?
429 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

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 52

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 52

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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
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 automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
Suggested Courses

764 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