drop down menu not pulling results

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default drop down menu not pulling results

    I have populated a dependent two select drop down menu without any trouble
    Im not at all sure on the Sql for the next step however.

    the drop down menu is Area (group) which populates Language (subgroup)

    <cfquery name="get_Main_Group" datasource="dependent">
    SELECT distinct group_id, group_name
    FROM tAbyL
    </cfquery>

    <cfquery name="get_Sub_Group" datasource="dependent">
    SELECT distinct group_id, subgroup_id, subgroup_name
    FROM tAbyL
    WHERE group_id = #page.select_Main_Group#
    </cfquery>

    Database
    table 1 (tAbyL)
    four fields: group_id, group_name, subgroup_id, subgroup_name

    Table 2 (tHbyL)
    six fields:hospital_id, hospital_name, group_id, group_name, subgroup_id,
    subgroup_name

    What i want to do
    1. use the populated drop down menu to query Table 2
    2. Result is a list of hospital names which are consistent with both the Area
    and Language

    my attempt
    SELECT tHbyL.hospital_name
    FROM tAbyL, tHbyL
    WHERE (([tAbyL]![subgroup_id]=[tHbyL]![subgroup_id] And [tHbyL]![group_id]));

    this sql pulls all names.

    result page
    <cfparam name="FORM.subgroup_id" default="1">

    <cfquery name="Recordset2" datasource="dependent">
    SELECT subgroup_id
    FROM tAbyL
    WHERE subgroup_id = #FORM.subgroup_id#</cfquery>
    <cfquery name="Recordset1" datasource="dependent">
    SELECT tHbyL.hospital_name
    FROM tAbyL, tHbyL
    WHERE (([tAbyL]![subgroup_id]=[tHbyL]![subgroup_id] And [tHbyL]![group_id]));
    </cfquery>
    <cfoutput>#Recordset1.hospital_name#</cfoutput>:confused;

    quiero mas Guest

  2. Similar Questions and Discussions

    1. drop down menu
      Do anyone know the way to create this kinda drop down menu as shown at the right hand side, http://www.macromedia.com/software/flash/. Thanks for any...
    2. Pulling the Verity Collection Name from Results
      I am running CFMX 6.1 on Windows 2000 Server. I am trying to use Verity to full-text search several collections, one of which is a MS SQL 2000...
    3. cfforms drop downs and results
      I am using the TabNavigator cffform and its works great. I have a dynamically created drop down using the cfselect from a query I have. Its a list...
    4. Pulling PRINT results from a stored procedure
      Hi, I'd like to pull the results of a sproc within ASP as a text field, e.g. PRINT statements, "### Rows Affected", etc. How would I go about...
    5. How do I build Drop Down menu using Menu magic with Database result
      Hi Every One. I resently purched Menu Magic Dropdown System. I would like to list my database content like news( few sentense with link ), Authers...
  3. #2

    Default Re: drop down menu not pulling results

    sorry forgot to say the problem
    1. on the search page as soos as i enter the target for the button the page
    when viewed in the web application goes straight to the result page with out
    giving me the chance to make the second choice. button is inside the form with
    the drop downs.
    2. Does the sql seem ok? I think its fine but just want expert opinion

    Regards Mark

    quiero mas Guest

  4. #3

    Default Re: drop down menu not pulling results

    On page1, attempting to run a query based on a selection in a drop down will
    always fail. You need a different approach.

    On page2, the 1st query (recordset2) doesn't seem to do anythng useful. The
    second query (recordset1) shouldn't have a semi-colon. Also, the where clause
    appears to be incomplete.

    Dan Bracuk Guest

  5. #4

    Default Re: drop down menu not pulling results

    ???????Dan for your help
    May i ask what you mean another approach? I managed to get this working for a
    simple sinlge select drop down.
    Do you think i should do this another way - without drop downs?
    Sorry Dan
    this has really been driving me mad.
    Once i ve got it done once a whole lot of other doors will open this two
    select is really holding me back.
    Regards MArk


    quiero mas Guest

  6. #5

    Default Re: drop down menu not pulling results

    Once a Cold Fusion page loads, nothing else can happen on the server. This
    means you don't get to run any more queries.

    If you want to query table2 based on a selection in a drop down list, you have
    to submit the form.

    Dan Bracuk Guest

  7. #6

    Default Re: drop down menu not pulling results

    Right thanks a lot ill give it a go. Thanks for you help and advice over the
    past few months. this is the last big hump in my project.
    Even though ive gone sideways here and there ive learned a lot thanks to this
    forum.
    When its done ill send you the URL.

    Much appreciated Dan
    Mark Holloway

    quiero mas Guest

  8. #7

    Default Re: drop down menu not pulling results

    Hi!
    you could use onChange="submit()" if the table you are quering are not too big
    but if you want one pull down to change according to the first pull down you will have to use Javascript


    jorgepino Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139