Owens, Howard wrote:

> I'm making my first UDF using CFFUNCTION ...
>
> It goes something like this:
>
> myFunction("arg1", "arg2", "arg3")
>
> If I hard code the arguments into the function call, it works fine.  But if
> I try this ... myFunction(form.myField), where "myField" is a list of the
> three arguments required, it doesn't work.  The error says the second
> argument (which is required) isn't being passed.
>
> Any suggestions as to why I can't pass my arguments via the form scope?

You can.  That's not the cause of the error.  Parameter declarations in a
function definition aren't a CF list.  They're placeholders for individual,
required arguments.  You're passing just a single parameter, not three, thus
the error message about the missing second argument.  If the individual values
that you want to pass are in a comma delimited list within a form field, you'd
need to use a call like:

myFunction(ListGetAt(form.myField, 1),
           ListGetAt(form.myField, 2),
           ListGetAt(form.myField, 3))

Or rewrite the function to expect a single argument consisting of a list
containing some number of items.


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to