If you're not a praying man, don't send the ArrayCollection.
ArrayCollection is really just a wrapper for an array that adds some
extra functionality like getItemAt(). Pass in the underlying array,
which would be optionsAC.source.
then you'll be able to type your cfargument to an array.
On Wed, May 14, 2008 at 2:59 PM, Jennifer Larkin <[EMAIL PROTECTED]> wrote:
> Oh nevermind, you said you did that. You could just leave the type off and
> pray.
>
> On Wed, May 14, 2008 at 2:59 PM, Jennifer Larkin <[EMAIL PROTECTED]> wrote:
>
>> You're going to hit yourself in the head when I say this, but have you
>> tried type="array"?
>>
>>
>> On Wed, May 14, 2008 at 2:50 PM, jason robinson <[EMAIL PROTECTED]>
>> wrote:
>>
>>> Hi there,
>>>
>>> I have a Flex app where I pass an arraycollection to my cfc. I've been
>>> trying to set the argument type as a 'struct' but I get an error stating
>>> that my arraycollection is not of type struct. I've also tries setting it as
>>> an array. No luck. Any thoughts?
>>>
>>> Thanks.
>>>
>>> Novian
>>>
>>> Code:
>>>
>>> <cffunction name="saveQuiz" access="remote" returntype="boolean"
>>> hint="Saves new quiz to quiz_questions.">
>>> <cfargument name="quizQuestion" type="string" required="yes">
>>> <cfargument name="quizAnswer" type="string" required="yes">
>>> <cfargument name="optionsAC" type="struct" required="yes">
>>> <cfset var qRead="">
>>> <cfquery name="savedQuizQuestion" datasource="my_db"
>>> result="savedQuizID">
>>> INSERT into quiz_questions (quizQuestion, quizAnswer)
>>> VALUES ('#ARGUMENTS.quizQuestion#', '#ARGUMENTS.quizAnswer#')
>>> </cfquery>
>>> <cfloop from="1" to="#ArrayLen(optionsAC.optionsArray)#" index="i">
>>> <cfquery name="savedQuizOptions" datasource="my_db">
>>> INSERT into quiz_options (quizID, optionName, correct)
>>> VALUES ('#savedQuizID.GENERATED_KEY#',
>>> '#optionsAC.optionsArray[i].label#', '#optionsAC.optionsArray[i].data#')
>>> </cfquery>
>>> </cfloop>
>>> <cfreturn true>
>>> </cffunction>
>>>
>>>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k
Archive: http://www.houseoffusion.com/groups/Flex/message.cfm/messageid:5251
Subscription: http://www.houseoffusion.com/groups/Flex/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.37