SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    Omaha, NE
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamic Dropdowns with out a submit

    Hi,

    I'm working on something that requires you to have menu driven options, meaning the selection in dropdown menu 1, drives what is show in dropdown menu 2. The catch is I need to be able to populate dropdown menu 2 with out actually submiting the page. So i figured I would create something in Javascript that creates arrays (using coldfusion), then populates the menu with those arrays. I can't quite seem to get something to work. Does anyone have any code snippets or skelton code that does this? One "gotchya" I seem to run into is the fact that my select option value is different from what the option displays (ie <option value="1">Ford</option> )

    Thanks for your help!
    "Oh, you hate your job? Why didn't you say so? There's a support group for that.
    It's called EVERYBODY, and they meet at the bar."

    --Drew Carey

  2. #2
    SitePoint Member rich_explus's Avatar
    Join Date
    Nov 2003
    Location
    Fort Collins CO
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried populating the second drop-down with empty <OPTION> elements in a quantity sufficient for your needs, then retroactively altering their properties as a result of the selection in the first pull-down? That's where I'd start.

    Another idea would be to have your CF code output all the complete <SELECT> boxes you'll need, but hide the second-tier ones until they're called on by the first-tier menu. I think show/hide is a little tricky with form elements, though. I know I did it in an intranet setting once, where i had control of the end user's browser choice; one div had the first form, the second div had the second form, and there was some JS necessary to show/hide and transfer info from the first form to the second. If you can get these techniques to work, you can get a very clean, quick "false submit" between steps 1 & 2, but I never had to try to code cross-browser for that trick. If you'd like, I can find the code I used for that and send it to you. Or better yet, you could try it with the sliding code in the CBE library at www.cross-browser.com .

    Why are you so dead-set against submitting the form in between? I know there's a latency issue, but it's bound to be cleaner and more universally functional than what you're trying here. I'm one of those developers who thinks that Javascript needs to be used sparingly and only for good reason....

    --Rich

  3. #3
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    Omaha, NE
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know for a fact that users will only be using IE as a browser so i don't need to worry about cross browser functionality.

    I would really appreciate if you could send me the code! That could be really useful. Please send it to epaisley@hotmail.com

    Thanks!
    "Oh, you hate your job? Why didn't you say so? There's a support group for that.
    It's called EVERYBODY, and they meet at the bar."

    --Drew Carey

  4. #4
    SitePoint Addict
    Join Date
    Jan 2002
    Location
    Omaha, NE
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks rich_explus !! Your help was key to getting to pointing me in the right direction!!! Thanks again
    "Oh, you hate your job? Why didn't you say so? There's a support group for that.
    It's called EVERYBODY, and they meet at the bar."

    --Drew Carey

  5. #5
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,340
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    epaisley, if all your users are using IE, then you must be on an intranet, so go ahead and make a round trip to the server

    here's another example of javascript-driven related selects:
    http://evolt.jeffhowden.com/jeff/cod...ed_selects.cfm

    by the way, rich, my first impression of that cross-browser site was very unfavourable, i could not scroll over to read the start of each line of text!! (see attachment)
    Attached Images Attached Images
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,340
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    hmmm, attachment did not come through after about an hour, let's try again

    Edit: i get the message "You have already attached this file to a post. If you need to refer to this file it can be found in this thread: Dynamic Dropdowns with out a submit" -- what's up with that, and how come it doesn't show??


Bookmarks

Posting Permissions

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