<CFIF IsDefined("url2.cat_id") IS True>
For a start, you don't need the "is true".
isDefined() works like this:
<cfif isDefined("myvar")>
do this
</cfif>
if you are looking for the opposite it would be
<cfif not isDefined("myvar")>
do this
</cfif>
You also don't need quotes around numbers.
As for the overall code, try this:
<cfset mode = "directory">
<cfif isDefined("url2.cat_id")>
<cfif #url2.cat_id# eq 100>
<cfset mode = "subcategory">
<cfelse>
<cfset mode = "category">
</cfif>
</cfif>
<CFSET mode = "directory">
<CFIF IsDefined("url2.cat_id") IS True>
<CFIF #url2.cat_id# IS "100">
<CFSET mode = "subcategory">
<CFELSE>
<CFSET mode = "category">
</CFIF>
</CFIF>
-----Original Message-----
From: Lisa Deemy [mailto:[EMAIL PROTECTED]
Sent: Saturday, October 15, 2005 9:53 PM
To: CF-Newbie
Subject: cfelse or cfelseif or neither
Any help or input on this would be appreciated.
I'm calling selected information from a database. There are several
categories and subcategories.
I want to call an entire category and list its subcategory contents for the
user.
I think the problem is in this part of the code as cfelse only appears 3
times in the entire code.
This (and other code) works to call all of category 103:
<CFSET mode = "directory">
<CFIF IsDefined("url.cat_id") IS True>
<CFIF #url.cat_id# IS "103">
<CFELSE>
<CFSET mode = "category">
</CFIF></CFIF>
I added this (and other code) to collect the same type of information form
category 100:
<CFSET mode = "directory">
<CFIF IsDefined("url2.cat_id") IS True>
<CFIF #url2.cat_id# IS "100">
<CFSET mode = "subcategory">
<CFELSE>
<CFSET mode = "category">
</CFIF>
</CFIF>
The error I'm getting is:
QueryString:
Error: Context validation error for tag CFELSE. The tag must be nested
inside a CFIF tag.
The error occurred on line -1.
My questions are: 1. Do I need the syntax of using the 2 parts together
different that just using one?
2. It appears I can't use <cfelseif > as it doesn't seem to like the < >
inside it's own < > tags.
<CFIF Condition><CFELSEIF Condition><CFELSE></CFIF>
Thanks,
Lisa
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Sams Teach Yourself Regular Expressions in 10 Minutes by Ben Forta
http://www.houseoffusion.com/banners/view.cfm?bannerid=40
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1443
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54