Results 1 to 4 of 4

Thread: Disable dropdown based on another dropdown's value [RESOLVED]

  1. #1

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Disable dropdown based on another dropdown's value [RESOLVED]

    I have a page with 2 dropdowns. One is called type and contains One-Time and Recurring. The other is frequency and contains many items.

    If a user selects Recurring from type, I want the Frequency dropdown to be available, but if they selected On-Time, I do not want Frequency to be available.

    How would I do that?

    Thanks!
    Last edited by rockies1; Mar 3rd, 2005 at 10:16 AM. Reason: Resolved
    Morgan
    [email protected] - Home
    [email protected] - Work
    Using VB6 SP6 but trying to learn VB2005EE

  2. #2
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602

    Re: Disable dropdown based on another dropdown's value

    Try this:

    HTML Code:
    <html>
    <head>
    <title>Disable Drop Down</title>
    
    <script type = "text/javascript">
    function disableDrop(){
         if(frmMain.sltMain.options[0].selected){
              frmMain.sltSecondary.disabled = true;
         }
         else{
             frmMain.sltSecondary.disabled = false;
         }
    }
    </script>
    </head>
    <body>
    
    <form ID = "frmMain">
    
    <select ID = "sltMain" onchange = "disableDrop();">
    <option value = "onetime">One-Time</option>
    <option value = "recurring" selected>Recurring</option>
    </select>
    
    <select ID = "sltSecondary">
    <option value = "1">One</option>
    <option value = "2">Two</option>
    <option value = "3">Three</option>
    <option value = "4">Four</option>
    </select>
    
    </form>
    
    </body>
    </html>
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

  3. #3

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Re: Disable dropdown based on another dropdown's value

    That worked perfectly, thank you!
    Morgan
    [email protected] - Home
    [email protected] - Work
    Using VB6 SP6 but trying to learn VB2005EE

  4. #4
    Fanatic Member Psyrus's Avatar
    Join Date
    Jul 2000
    Location
    NJ
    Posts
    602

    Re: Disable dropdown based on another dropdown's value

    Glad that I could help.

    Don't forget to edit the topic and add [RESOLVED] in the title.
    Chris

    VB 6.0 Calendar App Video Gamers Group
    Don't forget to rate people if they helped you.

Posting Permissions

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



Click Here to Expand Forum to Full Width