[thelist] <select> and defaulting to "All"
Jed Farr
jedf at antech.co.uk
Fri Aug 4 05:37:39 CDT 2000
You might want to have a look at the LIKE SQL keyword and use % instead of
*. Your select might now look like:
<select name="County"
size="1">
<option value="%" selected>All</option>
<option value="Aberdeenshire">Aberdeenshire</option>
<option value="Anglesey">Anglesey</option>
<option value="Angus">Angus</option>
<option value="Antrim">Antrim</option>... etc
And your query:
<cfquery name="getSearchResults" datasource="#application.database#"
dbtype="ODBC">
SELECT
tblCustomerDetails.CustomerID,tblCategories.CategoryID,CompanyName,County
FROM ((tblCustomer inner join tblCustomerDetails on
tblCustomer.CustomerID = tblCustomerDetails.CustomerID)
inner join tblCategories on tblCustomer.CategoryID =
tblCategories.CategoryID)
WHERE County LIKE '#form.County#'
AND tblCustomer.CategoryID = #form.CategoryID#
ORDER BY CompanyName
</cfquery>
I think that this would work with my db of choice (ms sql server), but
you'll have to check the syntax for your db.
Regards,
Jed.
________________________________________________________________
Jed Farr
jedf at antech.co.uk <mailto:jedf at antech.co.uk>
http://www.antech.co.uk
AnTech Ltd, Unit 7, Newbery Centre, Airport Business Park, Exeter UK. EX5
2UL
Tel +1 800 789 7515 Direct +44 (0)1392 440338 Fax: +1 281 754 4333
> -----Original Message-----
> From: David Crowther [mailto:david at SITD.COM]
> Sent: Friday, August 04, 2000 10:46 AM
> To: 'thelist at lists.evolt.org'
> Subject: [thelist] <select> and defaulting to "All"
>
>
> I am providing a compound search option in a site that I am coding in
> ColdFusion. The two search choices are by County and Category.
> I want to set the default option to "All" (all the counties)
> in the County
> field.
>
> For example:
>
> <select name="County"
> size="1">
> <option value="*" selected>All</option>
> <option value="Aberdeenshire">Aberdeenshire</option>
> <option value="Anglesey">Anglesey</option>
> <option value="Angus">Angus</option>
> <option value="Antrim">Antrim</option>... etc
>
>
> And my query code:
>
> <cfquery name="getSearchResults" datasource="#application.database#"
> dbtype="ODBC">
> SELECT
> tblCustomerDetails.CustomerID,tblCategories.CategoryID,Company
> Name,County
> FROM ((tblCustomer inner join tblCustomerDetails on
> tblCustomer.CustomerID = tblCustomerDetails.CustomerID)
> inner join tblCategories on tblCustomer.CategoryID =
> tblCategories.CategoryID)
> WHERE County = '#form.County#'
> AND tblCustomer.CategoryID = #form.CategoryID#
> ORDER BY CompanyName
> </cfquery>
>
> As you can see I have tried using a * as the first option in
> my <select>
> tag, but unfortunately this does not work.
>
> Does anyone have an idea how I can get this to work... many thanks in
> advance.
>
> David
>
> <tip type="Photoshop 5.5">
> Don't forget in Photoshop 5.5 to tick the "Only Web Colors"
> box in the Color
> Picker when you want to make sure your web site is web safe.
> </tip>
More information about the thelist
mailing list