change drop down box values on the fly

Discussion in 'HTML' started by Matt, Dec 2, 2004.

  1. Matt

    Matt Guest

    I have 2 drop down boxes. When the user changes the values in one drop
    down box,
    the values in another drop down box will be changed on the fly.

    Is it possible to do that? in client side or server side? what's the
    best approach to
    this problem?

    please help. thanks!!
     
    Matt, Dec 2, 2004
    #1
    1. Advertising

  2. Matt

    Mitja Guest

    On 2 Dec 2004 11:02:59 -0800, Matt <> wrote:

    > I have 2 drop down boxes. When the user changes the values in one drop
    > down box,
    > the values in another drop down box will be changed on the fly.
    > Is it possible to do that? in client side or server side?

    "on the fly" by itself implies client side, i.e. JavaScript.

    > what's the
    > best approach to this problem?

    server side processing, i.e. your favorite scripting language. Otherwise,
    the site won't work for people with JS disabled or unavailable.


    --
    Mitja
     
    Mitja, Dec 2, 2004
    #2
    1. Advertising

  3. On 2 Dec 2004 11:02:59 -0800, Matt <> wrote:

    > I have 2 drop down boxes. When the user changes the values in one drop
    > down box, the values in another drop down box will be changed on the fly.
    >
    > Is it possible to do that? in client side or server side? what's the
    > best approach to this problem?


    Yes, it is possible to do it both client-side and server-side. The best
    approach is to actually use both: attempt to do it on the client first and
    if that fails, fall back to the server. It's a little more work for you,
    but it provides both a quick and robust interface. If the script is kept
    in an external file (and it should), it should also reduce the total
    traffic as unscriptable user agents won't download unnecessary data.

    A generic client-side solution would be too bloated, so if you want a
    demonstration, it would be best to provide more information, preferably
    showing the page that will contain this feature.

    If you don't have the necessary server-side support (so only a client-side
    solution is possible), Richard Cornford provides a possible answer:
    <URL:http://www.litotes.demon.co.uk/example_scripts/dependent_select.html>.

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Dec 2, 2004
    #3
  4. On Thu, 02 Dec 2004 20:13:18 GMT, Michael Winter wrote:

    > ...The best
    > approach is to actually use both: attempt to do it on the client first and
    > if that fails, fall back to the server.


    What's the point of that? If you have server-side includes I cannot
    see the sense of attempting it client-side.

    F'Ups not set, but please consider doing so in future cross-posts.

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Dec 2, 2004
    #4
  5. Andrew Thompson, Dec 2, 2004
    #5
  6. On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson <>
    wrote:

    > On Thu, 02 Dec 2004 20:13:18 GMT, Michael Winter wrote:
    >
    >> ...The best approach is to actually use both: attempt to do it on the
    >> client first and if that fails, fall back to the server.

    >
    > What's the point of that? If you have server-side includes I cannot see
    > the sense of attempting it client-side.


    It's quicker for the user, basically. It also has the potential to reduce
    the number of requests made to the server.

    Based on your argument, why bother validating forms on the client when you
    can just wait for the server to throw back a message saying the user made
    a mistake?

    > F'Ups not set, but please consider doing so in future cross-posts.


    The post is valid in both groups, particularly as the discussion goes
    beyond just Javascript.

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Dec 2, 2004
    #6
  7. On Thu, 02 Dec 2004 20:40:49 GMT, Michael Winter wrote:

    > On Thu, 02 Dec 2004 20:25:29 GMT, Andrew Thompson <>
    > wrote:

    ....
    >> F'Ups not set, but please consider doing so in future cross-posts.

    >
    > The post is valid in both groups, particularly as the discussion goes
    > beyond just Javascript.


    (Head of legal team) What Mr. Thompson *meant* to say there was
    'Please set follow-ups once the most appropriate group becomes
    clear, assuming the there *is* a most appropriate group. Thank you
    for attending, that concludes the press conference. No autographs
    will be signed at this time.'

    (General hub-bub as legal team hussles Mr. Thompson from press conference)

    --
    Andrew Thompson
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.PhySci.org/ Open-source software suite
    http://www.1point1C.org/ Science & Technology
    http://www.LensEscapes.com/ Images that escape the mundane
     
    Andrew Thompson, Dec 3, 2004
    #7
  8. Matt

    Matt Kruse Guest

    Michael Winter wrote:
    > A generic client-side solution would be too bloated...


    I disagree [of course ;)]
    http://www.javascripttoolbox.com/dynamicoptionlist/

    Certainly more kb than a custom solution, but a) that may not matter and b)
    it could save considerable development and debugging time and allow the OP
    to achieve something they might otherwise lack the skill to implement.

    --
    Matt Kruse
    http://www.JavascriptToolbox.com
     
    Matt Kruse, Dec 3, 2004
    #8
  9. On Thu, 2 Dec 2004 22:36:22 -0600, Matt Kruse <>
    wrote:

    > Michael Winter wrote:
    >> A generic client-side solution would be too bloated...

    >
    > I disagree [of course ;)]
    > http://www.javascripttoolbox.com/dynamicoptionlist/


    I don't remember what precisely your code did, but as I was thinking about
    writing a demo, I realised that it would be pretty much useless unless I
    happened to do things exactly the way the OP would. Eventually, I came to
    a conclusion: I couldn't be arsed. :D

    [snip]

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Dec 3, 2004
    #9
  10. Matt

    Matt Guest

    thank you so much for the suggestions.

    If i do in client-side, then I use JavaScript event and <div> tag?

    If i do in server-side, then I will post the same page to server?

    please advise more. thanks!!
     
    Matt, Dec 3, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SirPoonga
    Replies:
    2
    Views:
    784
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,035
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    498
    msimmons
    Jul 16, 2009
  4. Matt
    Replies:
    6
    Views:
    106
  5. Replies:
    2
    Views:
    85
Loading...

Share This Page