You need a break; at the end of each case statement so that it knows
to stop processing your case statement. That's the only thing I can see
wrong with it. Maybe also check that there is no space before or after the
returned variable, also maybe try using quotes around the case 0 = case "0",
who knows if that will help.


Robert Everland III
Web Developer
Dixon Ticonderoga


-----Original Message-----
From: FWA [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 24, 2000 11:06 AM
To: [EMAIL PROTECTED]
Subject: Switch Statement in CFSCRIPT


This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C00DBB.414D3C00
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am having a problem with switch statement in a cfscript block.  It is =
always executing the last case, no matter what happens.  I have tried =
several different things and none of them seem to work.  I have checked =
that the switch expression is one of the cases and the statement seems =
to disregard the variable.  Any ideas?


I have done this with and without #'s around result and with and without =
the { } in the cases.   THANK YOU!!


switch (#result#) {
        case 0:
        {
            a =3D "u";
            f =3D "webbox";
            o =3D url.webreq;
            if(q.accref is 'A') {
                page =3D "editacc";
            }
            else {
                page =3D "editref";
            }
            file =3D "editboxd.cfm";
        }
        case 2:
        {
            a =3D "i";
            f =3D "webbox";
            o =3D url.webreq;
            page =3D "warn";
            file =3D "editboxd.cfm5";
        }
}

------=_NextPart_000_0015_01C00DBB.414D3C00
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I am having a problem with switch =
statement in a=20
cfscript block.&nbsp; It is always executing the last case, no matter =
what=20
happens.&nbsp; I have tried several different things and none of them =
seem to=20
work.&nbsp; I have checked that the switch expression is one of the =
cases and=20
the statement seems to disregard the variable.&nbsp; Any =
ideas?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have done this with and without #'s =
around result=20
and with and without the { } in the cases.&nbsp;&nbsp; THANK =
YOU!!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>switch (#result#)=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case=20
0:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
a =3D=20
"u";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; f =3D=20
"webbox";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
o =3D=20
url.webreq;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
if(q.accref is 'A')=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
page =3D=20
"editacc";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
else=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
page =3D=20
"editref";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
file =3D=20
"editboxd.cfm";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case=20
2:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
a =3D=20
"i";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; f =3D=20
"webbox";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
o =3D=20
url.webreq;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;=20
page =3D=20
"warn";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
file =3D "editboxd.cfm5";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV></BODY></HTML>

------=_NextPart_000_0015_01C00DBB.414D3C00--

----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to