I don't use the CT myself, but when a Category or Subcategory isn't selected, I 
suppose the form var will be an empty string.
So instead of using ParameterExists (You should use isdefined if you're on cf4+) test 
for that empty string.

<!-- Check for these variables -->
<cfif (Len(Form.Sub_Category))
AND (Form.Keyword is "")>

<!--- Only a Category is specified --->
<cfset THECriteria = "(CF_Custom2 <MATCHES> #Form.Sub_Category#) ">

<cfelseif (NOT Len(Form.Sub_Category))
AND (Form.Keyword is not "")>

<!--- Only Keywords are specified --->
<cfset THECriteria = "#Form.Keyword#">

<cfelse>

<!--- Category And Keywords are specified --->
<cfset THECriteria = "(CF_Custom2 <MATCHES> #Form.Sub_Category#)
AND (#Form.Keyword#)">

</cfif>


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: donderdag 4 april 2002 23:48
To: CF-Talk
Subject: Combining TWOSELECTSRELATED with a Keyword Search


A have a problem. I'm attempting to combine the custom tag TWOSELECTSRELATED with a 
Keyword Search. Here's how it should operate.

The idea is to search by category and 
subcategory only OR by text only OR using both the selects and text 
field. 

When I search using just the two selects related category/subcategory it works fine 
but when I only 
want to use the text field to search the application searches with 
the two selects as well. Definetly not what I want.

I think the problem is that the two selects related is always 
submitted but I don't know how to prevent it from being submitted. 
Any help suggestions appreciated. Here's a code snippet from the form 
page:

<!-- CF_TWOSELECTS BEGINS -->
<br><CF_TwoSelectsRelated
Query="Test1"
Name1="Category"
Name2="Sub_Category"
Display1="Category_Name"
Display2="Sub_Category"
FORCEWIDTH1="30"
FORCEWIDTH2="30"
Formname="Search"
Default1=""
Default2="">

______________________________________________________________________
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to