Question
Bizarre Error - Attribute Validation Error
Hi there,
After searching on how to reverse an array, I eventually stumbled upon a nice little piece of Java which would apparently do the trick. However, when I call this function it doesn't return anything. When I put the variable within a CFDUMP tag, I suddenly get an error:
" Attribute validation error.
The tag requires the attribute var. "
But, the attribute IS there. See my example code below.
<cfscript>
function arrayRev(myArray) {
return createObject("java", "java.util.Collections").reverse(myArray);
}
</cfscript>
<!--- This line DOES return my array, so now I know it is present --->
<cfdump var="#application.objRecursion.getBreadcrumbArray(url.item_id)#" />
<!--- This line gives me the error about the attribute VAR not being present. Clearly it is --->
<cfdump var="#arrayRev(application.objRecursion.getBreadcrumbArray(url.item_id))#" />
Now, clearly this is something to do with the function.
So, I have two questions:
1. Why is this function not working?
2. What is wrong with this function that is causing the error?
Many thanks,
Mikey.
After searching on how to reverse an array, I eventually stumbled upon a nice little piece of Java which would apparently do the trick. However, when I call this function it doesn't return anything. When I put the variable within a CFDUMP tag, I suddenly get an error:
" Attribute validation error.
The tag requires the attribute var. "
But, the attribute IS there. See my example code below.
<cfscript>
function arrayRev(myArray) {
return createObject("java", "java.util.Collections").reverse(myArray);
}
</cfscript>
<!--- This line DOES return my array, so now I know it is present --->
<cfdump var="#application.objRecursion.getBreadcrumbArray(url.item_id)#" />
<!--- This line gives me the error about the attribute VAR not being present. Clearly it is --->
<cfdump var="#arrayRev(application.objRecursion.getBreadcrumbArray(url.item_id))#" />
Now, clearly this is something to do with the function.
So, I have two questions:
1. Why is this function not working?
2. What is wrong with this function that is causing the error?
Many thanks,
Mikey.
