Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Junior Member
    Join Date
    Oct 2005
    Posts
    2
    Member #
    11658
    Is there a way to have a dropdown in a form appear based on a previous choice? For example, If I have a dropdown of countries and select the united states, another dropdown box will appear with all the different states in it to select from.

    Thanks for all of your help

  2.  

  3. #2
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    138 times
    I know it's possible in ASP and PHP, javascript I think as well.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  4. #3
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    If you wanted to you could use javascript like so:
    Code:
    function change()
    {
    if(document.form.country.value = 'Canada'
    {
    document.form.state.disabled = true
    document.form.state.style.visibility = 'hidden'
    document.form.prov.disabled = false
    document.form.prov.style.visibility = 'visible'
    }
    else
    {
    document.form.state.disabled = false
    document.form.state.style.visibility = 'visible'
    document.form.prov.disabled = true
    document.form.prov.style.visibility = 'hidden'
    }
    }
    HTML Code:
    <form name="form">
    <select name="country" onchange="change()">
    <option>Canada</option>
    <option>U.S.A.</option>
    </select>
    <select name="state" style="visibility:hidden;" disabled>
    <option>state</option>
    </select>
    <select name="prov" style="visibility:hidden;" disabled>
    <option>province</option>
    </select>
    Thee Pyro Wolf

  5. #4
    Senior Member MoRpHeUs's Avatar
    Join Date
    Apr 2005
    Location
    UHS-VILLE
    Posts
    139
    Member #
    9568
    pyrodragon your third select menu has a name error it should be named "prov"

    I'm not here for you, I'm here to raise your discomfort

  6. #5
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    Thankyou for informing me of this error morpheus
    Thee Pyro Wolf

  7. #6
    Senior Member MoRpHeUs's Avatar
    Join Date
    Apr 2005
    Location
    UHS-VILLE
    Posts
    139
    Member #
    9568
    no problem... need a space between Thank and you...lol...jk

    I'm not here for you, I'm here to raise your discomfort

  8. #7
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    Now morpheus correcting ones work constantly well helpful can be annoying given that as long as the point is across there is no reason to waste forum resources correcting tiny errors. Next time an error arises please feel free to PM me.
    Thee Pyro Wolf

  9. #8
    Senior Member MoRpHeUs's Avatar
    Join Date
    Apr 2005
    Location
    UHS-VILLE
    Posts
    139
    Member #
    9568
    ...got carried away...

    I'm not here for you, I'm here to raise your discomfort

  10. #9
    Junior Member
    Join Date
    Oct 2005
    Posts
    2
    Member #
    11658
    Ok this works, but I also need someway to lable the dropdown.
    i.e. State: (dropdown box)

    Is there a way to maie state disappear and change with province?


Remove Ads

Posting Permissions

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

Search tags for this page

drop down option based on previous html form

,

hide html based on previous select dropdown

Click on a term to search for related topics.
All times are GMT -6. The time now is 04:18 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com