How to do a cfdump inside a cfscript tag?

In order to debug I would like to dump certain variables on to my web page. How can I do that from inside a cfscript tag?

I tried the following but it isn't working:

  <cfif cgi.REMOTE_ADDR eq "IP">
    <cfdump var="#var1#"><br/>

Any clues on what can be done?


You can't do it directly like that in versions before CF 9. You can, however, use the dump() UDF found at CFLib. There's a whole library of UDFs there that mimic CF tags that don't have direct CFSCRIPT equivalents.

ColdFusion 9 (and up) offers the writeDump() function.

Adobe Documentation Linkfor WriteDump() function

use writeDump() like how you use writeOutput()

see writeDump on CF 9 reference

Isn't the following much easier and straightforward?

oAdmin = createObject("component", "cfide.adminapi.base");

It works on CF7 and forward, perhaps even earlier.

It would be fairly easy to write your own too. You just define a function in cfml rather than cfscript. You can use this to do cfaborts and cfloops as well.

Something like this (Off the top of my head...not executed).

    <CFDUMP VAR="#Obj#">
  if(cgi.REMOTE_ADDR eq "IP"){

Now plain tag names allowed within cfscript starting ColdFusion 11

    cfdump (var=#myVar#);

<cffunction name="setAbort" access="private" returntype="void" output="false">
 <cfdump var="#arguments#"/><cfabort>

For dump we use Writedump(myvar); instead of in cfscript and same we use abort; instead of for exit the execution of program at any instance.we use writeoutput(); instead of


below is the code for dump and abort in cfscript.

writedump(myvar); for dump

abort; for stop execution of programm 

writeoutput(myvar); for output within cfscript

Need Your Help

Disabling enter key for form

javascript html window

I have been trying to disable the Enter key on my form. The code that I have is shown below. For some reason the enter key is still triggering the submit. The code is in my head section and seems t...

How to display the value instead of percentage in a pie chart using jquery Highcharts

javascript jquery highcharts

for a project of mine im using a pie char that made with jQuery Highcharts. what like to do is to display the value i inserted instead of the the parentage. example: chart shows firefox - 43.269...%