You need a "break" command at the end of each case
----- Original Message -----
From: "FWA" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 24, 2000 9:05 AM
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. It is always executing the last case, no matter =
> what=20
> happens. I have tried several different things and none of them =
> seem to=20
> work. I have checked that the switch expression is one of the =
> cases and=20
> the statement seems to disregard the variable. Any =
> ideas?</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> <DIV><FONT face=3DArial size=3D2></FONT> </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. THANK =
> YOU!!</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> <DIV><FONT face=3DArial size=3D2>switch (#result#)=20
> {<BR> case=20
> 0:<BR> =20
> {<BR> =
> a =3D=20
> "u";<BR>  =
> ; f =3D=20
> "webbox";<BR> =
> =20
> o =3D=20
> url.webreq;<BR> &nbs=
> p; =20
> if(q.accref is 'A')=20
> {<BR> &n=
> bsp; =20
> page =3D=20
> "editacc";<BR>  =
> ; =20
> }<BR> =
> else=20
> {<BR> &n=
> bsp; =20
> page =3D=20
> "editref";<BR>  =
> ; =20
> }<BR> =
> file =3D=20
> "editboxd.cfm";<BR> =20
> }<BR> case=20
> 2:<BR> =20
> {<BR> =
> a =3D=20
> "i";<BR>  =
> ; f =3D=20
> "webbox";<BR> =
> =20
> o =3D=20
> url.webreq;<BR> &nbs=
> p; =20
> page =3D=20
> "warn";<BR> &n=
> bsp;=20
> file =3D "editboxd.cfm5";<BR> =20
> }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>}</FONT></DIV></BODY></HTML>
>
> ------=_NextPart_000_0015_01C00DBB.414D3C00--
>
> --------------------------------------------------------------------------
----
> Archives: http://www.mail-archive.com/[email protected]/
> 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/[email protected]/
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.