Will,
I believe that if you add a "where clause" to your SQL SELECT statement you
may get what you want. This where clause will make sure that your DBMS
associates the records in the table sub-categories with the appropriate ones
in the table categories.
Here's an example of what I mean:
<cfquery name="findcats" datasource="localads">
SELECT ID, cat_id, cat_name, sub_name
FROM categories, sub_categories
WHERE categories.id = sub_categories.cat_id
ORDER by cat_name
</cfquery>
-- Tim Dempsey
-----Original Message-----
From: W Luke [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 14, 2000 09:36
To: [EMAIL PROTECTED]
Subject: Re: Populating more than one Select
I tried that, but no luck :(
Thanks anyway
Will
----- Original Message -----
From: "Sima Lee" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 14, 2000 2:32 PM
Subject: Re: Populating more than one Select
> Hi,
>
> I remember I had the same problem before, by change the SQL statement to
> "Select distinct....." the problem was gone.
>
> I don't know if your problem is the same, but give it a try won't hurt.
>
> Hope it will help.
>
> Sima
> ----- Original Message -----
> From: W Luke <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Thursday, September 14, 2000 8:17 AM
> Subject: Re: Populating more than one Select
>
>
> > OK. I have a "Main Categoies" table (categories) and a "Sub Categories"
> > table (sub_categories). 'categories' has columns of ID and cat_name and
> > 'sub_categories' has columns of sub_name, cat_id, sub_id - cat_id is
in
> > place to link to the ID in 'categories'.
> >
> > I'm unsure of the query needed, and of what to put in VALUE1 and VALUE2.
> At
> > the moment, the first box is being populated fine, but the 2nd displays
> > *all* records in 'sub_categories'. Below is the code - any help of
advice
> > is appreciated.
> >
> > Will
> >
> > <cfquery name="findcats" datasource="localads">
> > SELECT ID, cat_id, cat_name, sub_name FROM categories, sub_categories
> > ORDER by cat_name
> > </cfquery>
> >
> >
> > <CF_TwoSelectsRelated
> > QUERY="findcats"
> > NAME1="Cat"
> > NAME2="Selected"
> > DISPLAY1="cat_name"
> > DISPLAY2="sub_name"
> > VALUE1="cat_id"
> > VALUE2="sub_name"
> > FORCEWIDTH1="70"
> > FORCEWIDTH2="70"
> > SIZE1="1"
> > SIZE2="1"
> > HTMLBETWEEN="<BR>"
> > AUTOSELECTFIRST="Yes"
> > EMPTYTEXT1="(choose a category)"
> > EMPTYTEXT2="(now choose a subcategory)"
> > ONCHANGE="Submit!"
> > FORMNAME="MyOtherForm">
> >
> > ----- Original Message -----
> > From: <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, September 14, 2000 2:06 PM
> > Subject: RE: Populating more than one Select
> >
> >
> > > As long as it's a fairly short bit of code, post away.
> > >
> > > -----Original Message-----
> > > From: W Luke [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, September 14, 2000 8:56 AM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: Re: Populating more than one Select
> > >
> > >
> > > Thanks. I've tried it out - unfortunately it's populating the same in
> the
> > > 2nd box every time. Have you set this up before and/or would you mind
> me
> > > pasting my code here?
> > >
> > > Cheers,
> > >
> > > Will
> > > ----- Original Message -----
> > > From: <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Thursday, September 14, 2000 1:19 PM
> > > Subject: RE: Populating more than one Select
> > >
> > >
> > > > You would want
> > > >
> > >
> >
>
http://devex.allaire.com/developer/gallery/info.cfm?ID=CA347197-2830-11D4-AA
> > > > 9700508B94F380&method=Full
> > > >
> > > > -----Original Message-----
> > > > From: W Luke [mailto:[EMAIL PROTECTED]]
> > > > Sent: Thursday, September 14, 2000 8:08 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Populating more than one Select
> > > >
> > > >
> > > > Hi,
> > > >
> > > > One one of my pages I have a Select which is dynamically populated
> using
> > > > some simple SQL. What I
> > > > now need to do is dynamically populate another Select, based on the
> > > > selection of the first Select Box. I don't want to load the page
> twice.
> > > >
> > > > Is this possible? I hope I've made my question clear..
> > > >
> > > > Thanks,
> > > >
> > > > Will
> > > >
> > > >
> > > >
> > >
> >
>
> --------------------------------------------------------------------------
> > > --
> > > > --
> > > > Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> > > > 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/cf-talk@houseoffusion.com/
> > > > 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/cf-talk@houseoffusion.com/
> > 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/cf-talk@houseoffusion.com/
> 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/cf-talk@houseoffusion.com/
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/cf-talk@houseoffusion.com/
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.