Sorry if you guys get this twice, but I just saw my post to Bud which was
sent after this and still haven't seen this come back in...

An amendment to my previous post:

I tried renaming every attribute and variable in the function and no matter
how they were renamed or moved or what attributes were omitted, etc. the 2nd
attribute in the function was always undefined?!!!?!?

So I tried reverting to cfscript to create the function and lo and behold,
it works!

        function alttext(itemid) {
                var mytext = structnew();
                if (arraylen(arguments) gt 1)
                        { mytext.no = arguments[2]; }
                else { mytext.no = "New"; }
                if (arraylen(arguments) gt 2)
                        { mytext.yes = arguments[3]; }
                else { mytext.yes = "Edit"; }

                if (not isnumeric(itemid)) { itemid = len(trim(itemid)); }

                return mytext[yesnoformat(itemid)];
        }

Did I miss a known bug or something?!!?

---

I'm working with a function that's designed to return
alternative values for "yes" or "no" from yesnoformat()

I have this code:

<cffunction name="alttext" returntype="string">
        <cfargument name="itemid" type="string" required="true">
        <cfargument name="no" type="string" defualt="New">
        <cfargument name="yes" type="string" default="Edit">

        <cfset var istrue = false>
        <cfset arguments["No"] = arguments[2]>
        <cfset arguments.no = arguments[2]>
        <cfdump var="#arguments#">

        <cfif not isnumeric(itemid)>
        <cfset itemid = len(trim(itemid))></cfif>

        <cfreturn arguments[yesnoformat(itemid)]>
</cffunction>


A couple of those lines were added to see if I could work around the
problem, which is that where the cfdump is executed, the value shown for
arguments.no is "[undefined struct element]" ... What I don't understand is
-- if the key exists, how is the struct element not defined? And if it was
obviously able to get the value of the key "no" from the cfargument tag, why
was it not able to get the default value "New"?

Incidentally, no exception is thrown when the value is false, it just
returns an empty string.

Any help greatly appreciated.

s. isaac dealey                954-776-0046

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

tapestry api is opensource     http://www.turnkey.to/tapi

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to