Thanks Duncan, I knew it would be something obvious!!

At 11:29 4/1/2003 +0100, you wrote:

if (blah)

else if (bleh)

else if (bluh)

...


Duncan Cumming IT Manager

http://www.alienationdesign.co.uk
mailto:[EMAIL PROTECTED]
Tel: 0141 575 9700
Fax: 0141 575 9600

Creative solutions in a technical world

----------------------------------------------------------------------
Get your domain names online from:
http://www.alienationdomains.co.uk
Reseller options available!
----------------------------------------------------------------------
----------------------------------------------------------------------




Dave Phipps


<[EMAIL PROTECTED] To: ColdFusion User group <[EMAIL PROTECTED]>
cf.co.uk> cc:


Subject: [ cf-dev ] elseif in cfscript
01/04/2003


11:25

Please

respond to

dev








Hi,


I am trying to cfscript some if/elseif statements and so far I have the
following which doesn't work:

<cfscript>
           if (IsDefined("session.currentuser")) {
                     if (StructFind(session.currentuser, "usergroups")
CONTAINS "Master") {
requiredPermission = "Master"; }
                     elseif (StructFind(session.currentuser, "usergroups")
CONTAINS
"Administrators") { requiredPermission = "Administrators"; }
                     elseif (StructFind(session.currentuser, "usergroups")
CONTAINS "Power
Users") { requiredPermission = "Power Users"; }
           }
</cfscript>

I wrote the above code based upon what I originally had in normal cf code:

<cfif IsDefined("session.currentuser")>
           <cfif StructFind(session.currentuser, "usergroups") CONTAINS
"Master">
                     <cfset requiredPermission = "Master">
           <cfelseif StructFind(session.currentuser, "usergroups") CONTAINS

"Administrators">
                     <cfset requiredPermission = "Administrators">
           <cfelseif StructFind(session.currentuser, "usergroups") CONTAINS
"Power
Users">
                     <cfset requiredPermission = "Power Users">
           </cfif>
</cfif>

This works although I would prefer to write it in cfscript. This is all on

CF5.

Does cfscript support elseif's? If not how do I alter the above so that it

will work?

I need the required permission to be set to the highest level available in
the usergroups list.  In other words if someone is a Master and an
Administrator then the requiredPermission will be set to Master.

Cheers

Dave


-- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]






-- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]


--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]



Reply via email to