Friends: Can anyone help with this problem I'm stuck on? Not sure if this
is a simple one or not, but in any case I'll sure be delighted to get it
working.
This set of pages allows the user to search a set of records using 9 search
objects. Four of those are for searching yes/no (1/0) fields in
Well if it doesn't matter just don't pass the parameter have it set with a
value of "" and
then when you run the query CFIF parameter IS "YES"where hottub =
Yes/CFIFetc
that way if they pass the parameter blank it won't include it in the search,
hence pulling
up records that do and/or don't
If you have a checkbox for the 'Don't Matter' or dont include, then
assign it a value then in the WHERE clause of the SQL test the value
and if it is one of those cases, do not include it in the SQL
Something along the lines of:
Select *
From MyTable
cfif NOT isdefined(checkboxdontmatter)
Why not use radio inputs? This way you can have something like this...
Search for properties with...
HotTub?
input type="radio" name="hottub" vaule="" Not Important.
input type="radio" name="hottub" vaule="1" I Need a Hottub!
Pool?
input type="radio" name="pool" vaule="" Not Important.
input
just set a condition to not do a WHERE statement in your SQL if they choose
"it don't matter"
- Original Message -
From: P@tty Ayers [EMAIL PROTECTED]
To: CF-Talk [EMAIL PROTECTED]
Sent: Wednesday, April 04, 2001 11:30 AM
Subject: How to Allow a "Doesn't Matter" Variable in a Search?
if you use checkboxes for the selections, use isDefined() on your action
page. if the checkbox for that selection is defined, include it in your
where clause
ex:
SELECT
WHERE
CFIF isDefined("FORM.hottub")
AND hottub field is yes
/CFIF
chris olive, cio
cresco technologies
[EMAIL
Patty -- Checkboxes might solve your problem 'cuz they only get passed as form values
if they're *checked.* Therefore, your query could simply string together only the
passed checkboxes for the Boolean case you describe below. The user says 'This
doesn't matter' by simply not checking a
For each dropdown box or checkbox, have 3 choices:
Y = Yes - I need this
N = No - I do not want this
D = Doesn't matter
When you go to set up the sql statment, do something like:
Select col1,col2,col3,etcfrom amenities
Where (1=1)
cfif hottubs is not 'D'
And ( hottubs =
The easiest way would be to simply _not_ include that field in the
WHERE clause of your query. The default characteristic of HTML
checkboxes helps because, if no elements for the checkbox group
are 'checked' or given default values then the variable is not passed
to the ACTION target.
SELECT
9 matches
Mail list logo