Skip to main content
Known Participant
February 16, 2009
Question

Related Selects - Cannot get it to work

  • February 16, 2009
  • 2 replies
  • 342 views
I am creating a report and need to use related selects, second pulldown dependent of first pulldown selection.

I found this example off the internet and it does exactly what I want to do :
http://www.webtricks.com/code/code.cfm?CodeID=18

However, when I attempt to make my substitution in the code, all I get for my second pulldown is the id numbers, no names. I am frustrated beyond belief ! Seems simple enough but I just cannot get it to work and I have been playing with this for over two weeks now.

Can somebody please show me how to do it ? Here is my query (the example uses two but I think it can be done in one)

<cfquery name="GetSites" datasource="dbName">
select distinct
s.siteID,
s.site,
a.siteID as areaID,
a.area as depot
from table1 s, table2 a
where s.siteID = a.siteID
and s.siteID <> 1

My first pulldown will be the site, and depending on what is selected, the second pulldown will be populated with the area (depot) for that site. I tried to substitute my varialbes into the url code and it did not work, Can somebody please show me the proper way to do this ? Thanks
    This topic has been closed for replies.

    2 replies

    Participating Frequently
    February 18, 2009
    Hi,
    I think when you are using JS code then you are assigning the value to the second Drop down box in this way:
    "document.formname.second_combo_box_name. text" = some_value
    So check "document.formname.second_combo_box_name. text" should be assigned area (depot) name in java script. It should not be number but area name.

    I hope this solves your query. Let me know on this.
    Inspiring
    February 17, 2009
    What does your code for the second select look like? What is your js code?