Hi all,

I got a cfc bean that models a sweater.
One of it's attributes is color.
The argument for color passed in is something like "t_gul".
I want to "translate" the color to normal language.

When I try the following (pseudo) code I get an error:

Element is undefined in a CFML structure referenced as part of an _expression_.
Tag Context D:\Inetpub\kunder\nordicprint\model\beans\genser.cfc
(I've made bold the line throwing the error)

Can someone explain why this does not work?

genser.cfc:

<cfcomponent
    displayname="genser"
    output="false"
    hint="A bean which models the genser form.">

    <!---
    PROPERTIES
    --->
    <cfset variables.instance = StructNew() />
   
    <!--- "translate" colors --->
    <cfset variables.colors = StructNew() />
   
    <cfset variables.colors["t_gul"] = "Yellow" />
    <cfset variables.colors["t_hvit"] = "White" />

   
    <!---
    INITIALIZATION / CONFIGURATION
    --->
    <cffunction name="init" access="public" returntype="genser" output="false">
        <cfargument name="objectid" type="uuid" required="false" default="#createUUID()#" />
        <cfargument name="farge" type="string" required="false" default="t_gul" />
       
        <cfscript>
            // run setters
            setObjectid( arguments.objectid);
            setFarge(arguments.farge);
        </cfscript>

        <cfreturn this />
     </cffunction>

    <!---
    ACCESSORS
    --->
    <cffunction name="setObjectid" access="public" returntype="void" output="false">
        <cfargument name="objectid" type="uuid" required="true" />
        <cfset variables.instance.objectid = arguments.objectid />
    </cffunction>
    <cffunction name="getObjectid" access="public" returntype="uuid" output="false">
        <cfreturn variables.instance.objectid />
    </cffunction>

    <cffunction name="setFarge" access="public" returntype="void" output="false">
        <cfargument name="farge" type="string" required="true" />
        <cfset variables.instance.farge = variables.colors[arguments.farge] />
    </cffunction>
    <cffunction name="getFarge" access="public" returntype="string" output="false">
        <cfreturn variables.instance.farge />
    </cffunction>

</cfcomponent>
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to