?
Solved

Using a variable inside value

Posted on 2013-06-17
2
Medium Priority
?
252 Views
Last Modified: 2013-06-18
I am trying to use cfloop to get data from database. I want to put data in the value inside input text tag.

MyVar is a variable and it goes from 1 to 5.
 
How can I get value from database.
 
<input name="AfterFunding#MyVar#T" type="text" value="#others.AfterFunding#MyVar#T#">

So this tag should be <input name="AfterFunding1T" type="text" value="#others.AfterFunding1T#"> and it goes until 5T. the name is working but the value doesn't recognize it because there are two sets of ##.
0
Comment
Question by:jkemple
[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
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 39256129
Use array notation. Since it's a query object, you'll also need to supply a query row number

ie       #queryName["someFixedName"& counterVariableHere ][ rowNumber ]


.. translated, something like this, where "1" is the first row of the query

     value="#others["AfterFunding"& MyVar &"T"][1]#"

... or you're using cfloop query, use currentRow instead of hard coding the row number

<cfloop query="others">
     <input value="#others["AfterFunding"& MyVar &"T"][ currentRow]#" ....>
</cfloop>
0
 

Author Closing Comment

by:jkemple
ID: 39257126
Thank you. It works.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

777 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