There are several ways to approach this.

It mainly depends on how the search is being performed.

It is best to do a combination of the two since CFFORM
generates Javascript which can fail to work on some
browsers.

Before performing the search assuming this is a text
field you would want to Compare the search
criteria using the Compare function.

<CFIF NOT Compare(SearchField, "")>
        Output an error message or throw
        an error etc, redirect back to
        search page etc. etc.
</CFIF>

Compare returns 0 if the comparison is Equal
which is why you would say "NOT Compare(string1,string2)"

And for most clients it is okay to use CFFORM which will
perform Client Side validation of the data, but on a
public site it is not the best idea to count on CFFORM
as people also disable Javascript. :)

Jeremy Allen
[EMAIL PROTECTED]
[Insert cool title here]



-----Original Message-----
From: LH Rothman [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 21, 2000 12:31 PM
To: CF Talk
Subject: Minimum Search Criteria


I've got a search interface w/ multiple criteria and it works great.
However, if the user selects NO options, all records in the database
appear.  How do I force the user into selecting a MINIMUM of 1 search
criteria or else an error message of some type appears?

Thank you!
-Laura (Newbie)

----------------------------------------------------------------------------
--
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.

Reply via email to