对集合进行 cfloop 后排序

Jef*_*iny 3 forms sorting coldfusion loops

所以我有这个代码:

<!-- New Array for my loop -->
<cfset filesArray = ArrayNew(1)>
<!-- index for loop -->
<cfset arrayIndex = 1>

<!-- When a user attaches a file jQuery attaches a
hidden input element to the DOM with an id of 'attachedFile(index)'
and a value of the file name. This loops over the form fields looking for input with
id of 'attachedFile(something)' and sticks it into my array-->
<cfloop collection="#FORM#" item="field">
    <cfif FindNoCase('attachedFile',field) IS 1>
        <cfset filesArray[arrayIndex] = field>
        <cfoutput>#filesArray[arrayIndex]#<br></cfoutput>
        <cfset arrayIndex = arrayIndex + 1>
    </cfif>
</cfloop>

<!-- I use this to sort my array, it outputs YES
so I know it works right up until here -->
<cfoutput>#ArraySort(filesArray,'text','asc')#</cfoutput>

<!-- Simple loop over my array so I can output what I'm creating, but I get an error
"ATTACHEDFILE1 cannot be converted to a number' -->
<cfloop array=#filesArray# index="i">
    <cfoutput>#filesArray[i]#</cfoutput>
</cfloop>
Run Code Online (Sandbox Code Playgroud)

我不知道在哪里尝试将索引 i 处的数组转换为数字,但这是我的全部代码。有人看到问题了吗?数组最后输出应该没问题,对吗?

Hen*_*nry 5

与数组一起使用时,索引 in<cfloop>不是数字。它实际上是数组中的元素。

我知道,这种措辞没有意义,但请检查文档。