Interdependent Drop Down Menus

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Interdependent Drop Down Menus

    Hello,

    I am curious to know if anyone is willing to share their code - or suggestions
    - for a set of 2 interdependent drop down menus of countries and then
    states/provinces? I can find some JavaScript help on creating the
    interdependent drop down menus statically, but cannot seem to get them to work
    when pulling the data from the database tables. Any help would be appreciated.

    Thanks in advance.

    John



    jfojtek Guest

  2. Similar Questions and Discussions

    1. Drop down menus using CSS
      Can anyone more experienced with Dreamweaver help me get my drop down menu to work in IE? By looking at the website I have been trying to fix,...
    2. drop down menus
      CC: It loads slowly because it is large relative to the target weight for a web page. The only remedy is to not use that method. Here are two...
    3. Drop-Down Menus?
      this might be a silly question, but what is the best way to use DW drop-down menus througout your site for navigation? Is there a way to put the...
    4. Drop Menus?
      Do I need a special software or different program to create in a normal flash page production, a drop menu that (a) drops when scrolled over, (b)...
    5. Why are drop-down menus so slow?
      First and foremost.... it's a very nice looking site. Nice muted colors, plenty of white space, and I like the "About" circle a lot. Not quite sure...
  3. #2

    Default Re: Interdependent Drop Down Menus

    you may need a combination of both. if you're referring to changing one menu
    based on anothers selection, then the best approach is to have the onchange
    fire a hidden popup which "draws" the contents of the other menu via CFQuery
    and Javascript on self.opener properties

    gwgiswebmaster Guest

  4. #3

    Default Re: Interdependent Drop Down Menus

    Thanks for the reply.

    What I want to do is have the first pull down menu be populated from a
    database query from the countries table. The second pull down would be ghosted
    until the first has been selected and then be a list of the states or provinces
    (or whatever other territory) for the chosen country - also from a database
    query with the relationship being the country code from the first selection.

    I would like to avoid a popup if possible and just have 2 pull down menus.

    Any ideas on how to implement your idea or mine?


    jfojtek Guest

  5. #4

    Default Re: Interdependent Drop Down Menus

    you can try the same approach using a hidden frame as well. if using the pop
    up, it would only be open for as long as it took to draw the 2nd menu, but I
    can understand your concern, especially with XP SP2 users.

    gwgiswebmaster Guest

  6. #5

    Default Re: Interdependent Drop Down Menus

    I agree - thanks for your input.
    jfojtek Guest

  7. #6

    Default Re: Interdependent Drop Down Menus

    the other way is to build a .js file via coldfusion and cffile, and download
    it to the users machine once...using some sort of cache stamp
    ..js?cacheStamp=3 that way they only have to download the content once, not each
    time they go to that page.

    david_h Guest

  8. #7

    Default Re: Interdependent Drop Down Menus

    david_h,

    I am not too concerned about the content being too much every time they need
    to reload it. This should only be used to set up an account or to change the
    account. But you do bring up an interesting topic about storing the content.

    Do you think it is worth the effort to download the file to the users maching
    knowing that 99% of the users are only going to see this screen once?

    If not, would you just do it with JavaScripting and how?


    jfojtek Guest

  9. #8

    Default Re: Interdependent Drop Down Menus

    Javascript to use on MAIN page:

    function changeStates() {
    var country = document.forms[0].country.value;
    var q = document.getElementById('queryDB');
    q.src = 'http://www.YOURSITE.com/state_query.cfm?country_id=' + country;
    }

    Country List Drop Down Box:

    Your DB Query Here

    <cfselect required="yes" name="country" style="font-size: 8pt; font-family:
    tahoma, arial;" query="countries" value="country_code" display="country name"
    multiple="no onChange="changeStates()"">

    State/Province Drop Down Box:
    <select name="stprov" style="font-size: 8pt; font-family: tahoma, arial;">
    </select>

    <iframe src="http://www.YOURSITE.com/state_query.cfm?country_id=US" width="0"
    height="0" id="queryDB" style="border: 0px;"></iframe>

    Code for Iframe Page

    YOUR STATE CODE QUERY HERE

    <script language="JavaScript" type="text/JavaScript">
    f = top.document.forms[0];
    for (i=f.stprov.length; i >= 0; i--)
    f.stprov = null;

    <cfoutput>
    f.stprov[$i] = new Option(#stateQuery.state_id#,#stateQuery.state_nam e#);
    </cfoutput>

    </script>

    bifnaked99 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