Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add values to a variable

Status
Not open for further replies.

xsw1971

Programmer
Jun 21, 2001
153
US
I am trying to add values and text to a variable based on other processing so that when I'm done I have created a table and just need to output the variable. Some of my values from grid fields.
Code:
<cfset v_msg = "">
<cfset v_msg = v_msg&"<tr><td>"&form.equip.original.reservation_id[counter]&"</td>">
<cfset v_msg = v_msg&"<td>"&form.equip.original.identifier_id[counter]&"</td>">
<cfset v_msg = v_msg&"<td>"&v_uid&"</td></tr>">

<table>
  <tr>
    <th>Rsv ID</th>
    <th>Ident ID</th>
    <th>User ID</th>
  </tr>
  #v_msg#
</table

It works fine with static data or with just one grid row, but when I put multiple grid output in there, as above, it throws an error at the first double-quote on the third CFSET (the identifier_id row). How can I dynamically add to the variable?

Thanks in advance!
-sg
 
i just ran a test using this code:

Code:
<cfparam name="form.testvalue1" default="value1">
<cfparam name="form.testvalue2" default="value2">
<cfparam name="form.testvalue3" default="value3">

<cfset v_msg = "">
<cfset v_msg = v_msg&"<tr><td>"&form.testvalue1&"</td>">
<cfset v_msg = v_msg&"<td>"&form.testvalue2&"</td>">
<cfset v_msg = v_msg&"<td>"&form.testvalue3&"</td></tr>">

<table>
  <tr>
    <th>Rsv ID</th>
    <th>Ident ID</th>
    <th>User ID</th>
  </tr>
  <cfoutput>#v_msg#</cfoutput>
</table
and it outputs fine, no errors- im guessing if it's erroring for you, it may have something to do with the contents of your form variables. try using cfdump to see the contents of your form, the format of your form variables poses some questions for me- are you trying to access your form variables by accessing the FORM structure using the [counter]? can you explain whats going on there a little better?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top