no no
you need to prefix the variables inside your customtag
ok
you have a file called "myPage.cfm" and another page called "customTag.cfm"
which is the customtag
from "myPage.cfm" you call your custom tag like this
<cf_customTag>
thats all fine
no when you pass values into you customtag like
<cf_customTag myName="Steve">
the "customTag.cfm" file recieves a scope of values called "Attributes".
Just say you wanted to output the myName value inside your customtag, you
would need to do the following
<cfoutput>#Attributes.myName#</cfoutput>
So in your case you would do the following
CFM Page
-------------------------------------------------------------------
<cf_selectoffices SelectedOfficeID="#SelectedOfficeID#" Debug="true">
--------------------------------------------------------------------
Customtag (SelectOffices.cfm)
---------------------------------------------------------------------
<cfif isDefined("Attributes.Debug")>
<cfdump var="#Attributes#"><cfabort>
</cfif>
<cfquery name="getOfficeLocs" datasource="mydata">
SELECT YOfficeID AS SelectedOfficeID, OfficeName
FROM YesOffices
WHERE Active = 1
ORDER BY OfficeName
</cfquery>
<cfquery name="getSelectedOffice" datasource="mydata">
SELECT YOfficeID AS SelectedOfficeID, OfficeName
FROM YesOffices
WHERE Active = 1
AND Yofficeid=#Attributes.SelectedOfficeID#
</cfquery>
---------------------------------------------------------------------
Note that when you use values being passed into a customtag within tha
customtag its self, you have to prefix the variables with the "Attributes"
prefix
Make sense?
Regards
Steve Onnis
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Andrew
Dickinson
Sent: Thursday, January 22, 2004 9:55 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: custom tag weirdness
Hi Steve and Ryan
Still no difference.
Steve, I've inserted the diagnostic code as the top, but CF isn't even
getting that far. It's still stopping at the tag call i.e. :
"
<cf_selectoffices SelectedOfficeID="#attributes.SelectedOfficeID#"
Debug="true">
"
The word "attributes" makes no difference.
> Andrew
>
> Firstly, you dont need <CFOUTPUT> around queries. CFQUERY processes all
> outputs within the CFQUERY block anyway.
>
> Put this in your customTag at the top of the file
>
> <cfif isDefined("Attributes.Debug")>
> <cfdump var="#Attributes#"><cfabort>
> </cfif>
>
>
> then pass your values into your custom tag like this
>
> <cf_selectoffices SelectedOfficeID="#SelectedOfficeID#" Debug="true">
>
> what this will do is dump the attributes and their values to the screen
>
> My guess is that the "SelectedOfficeID" value being passed in is making
the
> query error
>
> Regards
> Steve
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Andrew
> Dickinson
> Sent: Thursday, 22 January 2004 9:29 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] custom tag weirdness
>
>
> My first tag is not going according to plan.
>
> I'm attempting to reuse this code :
>
> <cfoutput>
> <cfquery name="getOfficeLocs" datasource="mydata">
> SELECT YOfficeID AS SelectedOfficeID, OfficeName
> FROM YesOffices
> WHERE Active = 1
> ORDER BY OfficeName
> </cfquery>
> <cfquery name="getSelectedOffice" datasource="mydata">
> SELECT YOfficeID AS SelectedOfficeID, OfficeName
> FROM YesOffices
> WHERE Active = 1
> and Yofficeid=#SelectedOfficeID#
> </cfquery>
> </cfoutput>
>
> ... which sets up for a dropdown menu.
>
> I've saved this code as SelectOffices.cfm, and called it as
> <cf_selectoffices> - this is as
> the CFMX reference manual suggests.
>
> The problem seems to be the parameter. When I modify the call to
> <cf_selectoffices SelectedOfficeID="#SelectedOfficeID#">
> it falls over, pointing to an error on this line
> "and Yofficeid=#SelectedOfficeID#"
>
> So I went back to the book and followed the starter example, wihch simply
> creates a file called date.cfm containing today's date, then calls
<cf_date>
> from a
> different program. This works. However, when I try to pass a parameter,
> any parameter, using any of the methods in the book, it doesn't work (i.e
> throws an error).
>
> What am I missing here ?
>
>
>
>
>
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
> http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004