dumping form variables

Occasionally I need to see the form variables passed from the form to the next page. There are a couple of ways to do it depending on your needs.

CFDump is probably the easiest and outputs the results to a table
cfdump var="#Form#">

But I tend to use this one more. I can put cfif statements inside the loop and control which variables are seen or I can apply data formats (dates, currency, case,etc) based on the fieldname.
<cfoutput>
<table>
<CFLOOP index="x" list="#FORM.FIELDNAMES#">
<tr><td>#x#</td><td>#FORM[x]#</td></tr>
</CFLOOP>
</table>
</cfoutput>

Note: both will show hidden elements from the form as well as a list of the fieldnames.

Cup size   
Select size then click on coffee cup.
This entry was posted in Code, Coldfusion, Snippets. Bookmark the permalink.