[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 474
  • Last Modified:

CFDOCUMENTITEM error after upgrade to CF8

We've recently moved a site from a server running CF7 to one running CF8. I had been using CFDOCUMENT to generate a report as a PDF file without any problems, that is until we moved the site. I can still run the report successfully on the CF7 server, but the identical code on the CF8 server gives me this error:

The cause of this exception was that: coldfusion.runtime.UndefinedElementException: Element HARDWARETYPE is undefined in ATTRIBUTES..

I know that attributes.hardwaretype is defined, it's so frustrating! It's a list I'm looping through within a CFDOCUMENTITEM tag, type header. When I comment out the header, I get the same undefined error for my next attributes variable, contained within another CFDOCUMENTITEM tag, type footer. When I comment out the footer, the report runs fine, even though I have other variables from the attributes scope within my CFDOCUMENTSECTION tag.

I had hoped a Hot Fix would take care of the problem, but I think we're up-to-date. We're running CF Version 8,0,1,195765 -- shouldn't that already include all cumulative hot fixes?

Any help would be much appreciated :-)
0
cafoster
Asked:
cafoster
  • 6
  • 5
  • 3
2 Solutions
 
_agx_Commented:
Can you post a small example that demonstrates the issue?
0
 
cafosterAuthor Commented:
Here's a pared-down version that generates the same error ...

<cfdocument format="pdf" orientation="landscape" pagetype="letter">

<cfoutput query="getInventory" group="Dept">
<cfdocumentsection marginbottom=".75" marginleft=".25" marginright=".25" margintop="1">

<html>
<head>
<title>Summary</title>
</head>
<body>

<!--- SET AND DISPLAY HEADER INFORMATION --->

<cfdocumentitem type="header">
      <div>
            CNTS
            <cfloop list="#attributes.hardwaretype#" index="x">
                  <cfif ListLen(attributes.hardwaretype) gt 1 and ListLast(attributes.hardwaretype) eq x> and <cfelseif ListFirst(attributes.hardwaretype) neq x>, </cfif>
                  #x#
            </cfloop> Inventory by Department,
            <cfif val(attributes.ageinmonths) eq 0>Entire Inventory<cfelse>#val(attributes.ageinmonths)# Months or Older as of #DateFormat(Now(),"m/d/yyyy")#</cfif>
      </div>
</cfdocumentitem>

...
0
 
SidFishesCommented:
unless I'm mistaken, (which is frequent and quite likely) attbitutes should (must?) be attributes of a cf tag

and use it in AttributeCollection
<tagname attributeCollection="#structureName#">

ie: the only attrbiute of cfdocumentitem is type with possible values of header|footer|Pagebreak
afaik "HARDWARETYPE" is not an -attribute- of any cftag

so i think you are using the wrong variable scope
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
SidFishesCommented:
(and CF8 is just being -pickier- than cf7)
0
 
SidFishesCommented:
attbitutes ??? geez that wasn't even close

0
 
_agx_Commented:
Yes, "attributes" is a special scope of custom tags:  ie cf_mytagName  .  "Arguments" is a scope available to cffunctions.

Is this code called within a custom tag?
0
 
_agx_Commented:
> geez that wasn't even close

These days if I get more than 50% of the letters right, I declare victory and call it a job well done.
0
 
SidFishesCommented:
agx - fyi in CF8, use of attribute has been expanded from custom tags to be available to most cftags by using AttributeCollection

good explanation here
http://www.bennadel.com/blog/755-Learning-ColdFusion-8-Defining-Tags-With-AttributeCollection.htm
0
 
_agx_Commented:
Yes, you are correct.  I knew about that one, but haven't used it yet so I totally forgot about it.  

Since they are migrating the code from MX7, I was assuming the attributes scope was coming from the usage a custom tag.  Maybe it is conflicting with the scope CF8? Is that what you are suggesting?
0
 
SidFishesCommented:
i don't think adobe would break backward compat for custom tags by introducing a -competing- scope...

more probably 7 was a bit more forgiving for variables in the wrong scope ie: as you suggested attribute vs argument
0
 
cafosterAuthor Commented:
It does seem that CF8 is less forgiving when it comes to variable scope ... I've created and used an unscoped version of each "attributes" variable within my CFDOCUMENTITEM tags, and the report now runs without a problem. The report is part of a Fusebox 2 site, which uses the attributes scope heavily. As long as this little workaround does the trick, I'm happy :-)
0
 
SidFishesCommented:
in fusebox you might want to look at the request scope... I use it heavily in an FB3 app
0
 
cafosterAuthor Commented:
Thanks for the tip ;-)
0
 
_agx_Commented:
> i don't think adobe would break backward compat for custom tags by introducing a -competing- scope...

Hmm... normally they don't.  But unless my example is wrong, it doesn't work (ie it is broken)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 6
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now