Steve,


Why don't you do one select that joins the tables.  Then you can use the
multiselects related with cf and _javascript_ tutorial I wrote.


The tutorial can be found at http://tutorial196.easycfm.com
<http://tutorial196.easycfm.com>   It deals with 3 related selects, but
should be easily converted to two selects.


Steve

-----Original Message-----
From: Steve Logan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 06, 2004 2:49 PM
To: CF-Talk
Subject: CF / _javascript_ question

I was looking around for a code example of this and haven't been able to
find one - it's definitely something that's been on my list of "must learn"
- now it's a need to learn item.

I have 2 tables in my db - one is partcategory and one is partsubcatetory.
I have a CF snippet set to create a form select pulldown off of the first
table, but what I want to have happen is when they make a selection from the
first pull down (onChange) run a 2nd query to populate the subcategory with
the appropriate items.

The part category pulldown select code is this:

<!--- part cat select pulldown --->
<cfquery name="selPartCat" datasource="#Session.DSN#">
   select * from partcategory
</cfquery>
<cfparam name="PartCategorySelect" default="">
<cfparam name="FindCategory" default="">
<cfset PartCategorySelect=PartCategorySelect & '<option value="0"'>
<cfset PartCategorySelect=PartCategorySelect & ">" & "--Make A Selection--">
<cfoutput query="selPartCat">
  <cfset PartCategorySelect=PartCategorySelect & '<option
value="#selPartCat.pc_id#"'>
  <cfif pc_id eq FindCategory>
<cfset PartCategorySelect=PartCategorySelect & "
selected">
</cfif>
  <cfset PartCategorySelect=PartCategorySelect & ">" &
#selPartCat.pc_category#>
</cfoutput>
<cfset PartCategorySelect=PartCategorySelect & "</select>">
<cfset PartCategorySelect='<select name="PartCategorySelect">'  &
PartCategorySelect>

<!--- end part cat pulldown --->

<cfoutput>#PartCategorySelect#</cfoutput>

This gives me a nice pulldown with the correct values and selection names.
Now I'm stuck on the _javascript_ to get the 2nd query / pulldown to be
created.

Thanks.

Steve
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to