This seems strange to me, but perhaps it is expected behavior. If you
have a function that has an argument with required="false" and in that
function you loop over collection="#arguments#", the loop includes
that argument.
<cffunction name="test">
        <cfargument name="foo" required="true">
        <cfargument name="bar" required="false">
        <cfdump var="#arguments#"><cfabort >
</cffunction>

<cfoutput>#test(foo='hello')#</cfoutput>

The cfdump output will show both foo and bar, with bar saying
[undefined struct element]. It is in the collection. I want to loop
through the collection but not see that argument if it wasn't passed
in. My solution for now is along these lines:

                <cfloop collection="#arguments#" item="theKey">
                        <cfif StructKeyExists(arguments, theKey)>
                        ... code here ...
                        </cfif>
                </cfloop>

It seems strange to have to do this, but if I don't, then code will
run for an argument that shouldn't.
-- 
Matt Williams
"It's the question that drives us."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to