<cfscript>
switch(fuse)
{
case "login":
{
ArrayAppend(IncludeArray,"DisplayFiles\dsp_Login.cfm");
break;
}
case "logout":
{
include("ActionFiles\act_logout.cfm");
relocate("index.cfm?fuse=login&message=You have been successfully logged out.");
break;
}
I have a large controller (2500 lines or so) file that makes a lot of object calls within my switch statements and when using switch and case statements within cfscript I would get a "Invalid method Code length" error. Once I converted the switch statements to markup everything worked fine...
<cfswitch expression="#fuse#">
<cfcase value= "login">
<cfscript>
ArrayAppend(IncludeArray,"DisplayFiles\dsp_Login.cfm");
</cfscript>
</cfcase>
<cfcase value= "logout">
<cfscript>
include("ActionFiles\act_logout.cfm");
relocate("index.cfm?fuse=login&message=You have been successfully logged out.");
</cfscript>
</cfcase>
have you filed the bug? http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html
ReplyDeleteNo I didn't. I'm not sure why either, I filed a bug with Adobe the second I found something wrong with CFBuilder.
ReplyDeleteIs this a CFSwitch-specific problem? Or a file-length problem? I remember reading somewhere that a file can only be a certain size - perhaps the long switch is just crossing that threshold.
ReplyDeleteOf course, if that were the case, I am not sure why a tag version would be less likely to break. I guess this is a unique problem.
Ben, do you know of a tool that will let me see the classes that ColdFusion creates under the hood when it compiles a template? I'd like to see the difference in a class that uses cfscript vs tags for a case statement.
ReplyDelete