Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8103471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:33:27+00:00 2026-06-05T23:33:27+00:00

I am trying to make a form using two drop down select menus: one

  • 0

I am trying to make a form using two drop down select menus: one to select the category, the other to select a subcategory. I am trying to make it so the subcategory options are based on which category they select first, I don’t know where to begin on this and a google search is leaving me empty handed. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:33:28+00:00Added an answer on June 5, 2026 at 11:33 pm

    This is what you want:
    Note that this is only using html and pure javascript. Yes you can use JQuery too.

    <html>
    <head>
    
    <script language="javascript" type="text/javascript">
    function dropdownlist(listindex)
    {
    
    document.formname.subcategory.options.length = 0;
    
    switch (listindex)
    {
        case "category1" :
            document.formname.subcategory.options[0]=new Option("subcategory1.1","value1.1");
            document.formname.subcategory.options[1]=new Option("subcategory1.2","value1.2");
            document.formname.subcategory.options[2]=new Option("subcategory1.3","value1.3");
            break;
    
        case "category2" :
            document.formname.subcategory.options[0]=new Option("subcategory2.1","value2.1");
            document.formname.subcategory.options[1]=new Option("subcategory2.2","value2.2");
            document.formname.subcategory.options[2]=new Option("subcategory2.3","value2.3");
            break;
    
        case "category3" :
            document.formname.subcategory.options[0]=new Option("subcategory3.1","value3.1");
            document.formname.subcategory.options[1]=new Option("subcategory3.2","value3.2");
            document.formname.subcategory.options[2]=new Option("subcategory3.3","value3.3");
            break;
    
        default:
            document.formname.subcategory.options[0]=new Option("Select Category")
            break;
    }
    return true;
    }
    </script>
    </head>
    
    <title>Dynamic Drop Down List</title>
    
    <body>
    
    <form id="formname" name="formname" method="post" action="submitform.asp" >
    <table width="50%" border="0" cellspacing="0" cellpadding="5">
    <tr>
    <td width="41%" align="right" valign="middle">Category :</td>
    <td width="59%" align="left" valign="middle"><select name="category" id="category" onchange="dropdownlist(this.options[this.selectedIndex].value);">
    <option value="">Select Category</option>
    <option value="category1">category 1</option>
    <option value="category2">category 2</option>
    <option value="category3">category 3</option>
    </select></td>
    </tr>
    <tr>
    <td align="right" valign="middle">Sub Category :
    </td>
    <td align="left" valign="middle"><script type="text/javascript" language="JavaScript">
    document.write('<select name="subcategory"><option value="">Select Sub-Category</option></select>')
    </script>
    <noscript><select name="subcategory" id="subcategory" >
    <option value="">Select Sub-Category</option>
    </select>
    </noscript></td>
    </tr>
    </table>
    
    </form> 
    
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make form elements fit into a visual style with other
I'm trying to make a two-step confirmation like heroku using Devise. My routes: devise_for
I am trying to make a form that has inline editing (using jEditable) and
I am trying to make a form letter using PHP. I have a view
I'm trying to make a form to set values to two children objects through
I am trying to make a form field for a datetime property that allows
In a Symfony2 website I'm trying to make a form with 2 (or 3)
I'm fairly new to javascript and I'm trying to make an form for my
I'm trying to make a simple form, but it's working not so fine. This
I'm trying to make a dynamic form of questions and answers, like so: Question

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.