Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
murpg #1
Outputting a CFC Component
Can someone please help me with this simple request. I get an error message
when I try and output the results of a simple CFC Component. Here is the error
message:
Attribute validation error for tag cfoutput.
The value of the attribute query, which is currently "GetHomePageInfoRet", is
invalid.
Here is the component and the cfinvoke.
<cfcomponent displayname="Home Page Content" hint="This manages content">
<cffunction name="GetHomePageInfo" output="yes" returntype="query"
displayname="Get Home Page Content" hint="Function to get the content for the
PS Hospitality Home Page">
<cfquery name="gethome_info"
datasource="psfu"
dbtype="ODBC">SELECT *
FROM home
</cfquery>
<cfreturn gethome_info>
</cffunction>
</cfcomponent>
<p class="homeheader"><cfinvoke
component="psaims.PScontent"
method="GetHomePageInfo"
returnvariable="GetHomePageInfoRet"><cfoutput
query="GetHomePageInfoRet">#subtag#</cfoutput></p>
<p align="left"><cfoutput
query="GetHomePageInfoRet">#info#</cfoutput></cfinvoke></p>
murpg Guest
-
Problems outputting to PDF and PS
I apologize if this isn't the correct newsgroup for this inquiry but here goes. I am trying to output textfile (from Appleworks) to either a PDF... -
Outputting an animation 101
I created a home page via ImageReady 7.0 and there is an image on the page that is an animation. It is basically a photo that is fading from 100% to... -
[PHP] XX outputting X signs
Would it not make sese to store the number as a decimal and have the '£' added at output? George, in Oxford, where £££=pints -
£ outputting £ signs
Hello all Can someone tell me where i am going wrong here. I am trying to echo a '£' to the screen which has come from a database field. I get the... -
outputting XML from PHP
Today I decided to teach myself both PHP and XML ... so I decided to make a little address book. After I finished it I found this:... -
Darryl A. J. Staflund #2
Re: Outputting a CFC Component
Try this:
<cfcomponent displayname="Home Page Content" hint="This manages content">
<cffunction name="GetHomePageInfo" output="yes" returntype="query">
<cfset var gethome_info = "" />
<cfquery name="gethome_info" datasource="psfu" dbtype="ODBC">
SELECT * FROM home
</cfquery>
<cfreturn gethome_info>
</cffunction>
</cfcomponent>
Darryl
"murpg" <webforumsuser@macromedia.com> wrote in message news:d85j56$es2$1@forums.macromedia.com...> Can someone please help me with this simple request. I get an error message
> when I try and output the results of a simple CFC Component. Here is the error
> message:
>
> Attribute validation error for tag cfoutput.
> The value of the attribute query, which is currently "GetHomePageInfoRet", is
> invalid.
>
> Here is the component and the cfinvoke.
>
>
>
>
> <cfcomponent displayname="Home Page Content" hint="This manages content">
> <cffunction name="GetHomePageInfo" output="yes" returntype="query"
> displayname="Get Home Page Content" hint="Function to get the content for the
> PS Hospitality Home Page">
> <cfquery name="gethome_info"
> datasource="psfu"
> dbtype="ODBC">SELECT *
> FROM home
> </cfquery>
> <cfreturn gethome_info>
> </cffunction>
> </cfcomponent>
>
> <p class="homeheader"><cfinvoke
> component="psaims.PScontent"
> method="GetHomePageInfo"
> returnvariable="GetHomePageInfoRet"><cfoutput
> query="GetHomePageInfoRet">#subtag#</cfoutput></p>
>
> <p align="left"><cfoutput
> query="GetHomePageInfoRet">#info#</cfoutput></cfinvoke></p>
>
Darryl A. J. Staflund Guest
-
murpg #3
Re: Outputting a CFC Component
I tried your suggestion. Is there something wrong with the way I am trying to
output this? Here is my error message.
The value of the attribute query, which is currently "GetHomePageInfoRet", is
invalid.
murpg Guest
-
TA-Selene #4
Re: Outputting a CFC Component
You don't need to hae output set to yes on this function. This should ONLY be
used if the function itself will be displaying data, and this is not
recommended. You are not outputting anything, you are returning a query.
I don't know if that is causing the problem, but I can't see anything else
wrong with this call.
TA-Selene Guest
-
Adam Cameron #5
Re: Outputting a CFC Component
> I don't know if that is causing the problem, but I can't see anything else
Really?> wrong with this call.
What about the fact the <cfoutput> statements are *within* the <cfinvoke>
tags?
Probably best to have them AFTER the method has been called, not during,
eh? ;-)
NO:
<cfinvoke
component="psaims.PScontent"
method="GetHomePageInfo"
returnvariable="GetHomePageInfoRet"><cfoutput
query="GetHomePageInfoRet">#subtag#</cfoutput></p>
<p align="left"><cfoutput
query="GetHomePageInfoRet">#info#</cfoutput></cfinvoke>
YES:
<cfinvoke
component="psaims.PScontent"
method="GetHomePageInfo"
returnvariable="GetHomePageInfoRet">
<cfoutput
query="GetHomePageInfoRet">#subtag#</cfoutput></p>
<p align="left"><cfoutput
query="GetHomePageInfoRet">#info#</cfoutput>
Note: You only need a closing </cfinvoke> tag if you're using
<cfinvokeargument> tags.
--
Adam
Adam Cameron Guest
-
TA-Selene #6
Re: Outputting a CFC Component
I missed that you had the </cfinvoke> tag after your CFOUTPUT. That is indeed
what is causing the problem. The queries won't exist until after the invoke is
processed, which won't be finished until the closing tag is reached. The only
thing you should have nested within your CFINVOKE tags are tags that pass
information to/from the object.
TA-Selene Guest



Reply With Quote

