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

  • Home
  • SEARCH
  • 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 7838327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:04:16+00:00 2026-06-02T15:04:16+00:00

I have this form below which is perfect for my needs with dependent fields.

  • 0

I have this form below which is perfect for my needs with dependent fields. What I would like to do is when someone selects one of the subcategories (ie: Beddings), they would then be transferred to a url (ex: http://www.beddings.com). But this is far beyond my understanding!

Any help would be appreciated!

Here is a demo of this form: http://www.tamilcodes.com/demopages/jsdropdownlist.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script language="javascript" type="text/javascript">
function dropdownlist(listindex)
{

document.formname.subcategory.options.length = 0;
switch (listindex)
{

case "Home Ware" :
document.formname.subcategory.options[0]=new Option("Select Sub-Category","");
document.formname.subcategory.options[1]=new Option("Air-Conditioners/Coolers","Air-                               Conditioners/Coolers");
document.formname.subcategory.options[2]=new Option("Audio/Video","Audio/Video");
document.formname.subcategory.options[3]=new Option("Beddings","Beddings");
document.formname.subcategory.options[4]=new Option("Camera","Camera");
document.formname.subcategory.options[5]=new Option("Cell Phones","Cell Phones");

break;

case "Education" :
document.formname.subcategory.options[0]=new Option("Select Sub-Category","");
document.formname.subcategory.options[1]=new Option("Colleges","Colleges");
document.formname.subcategory.options[2]=new Option("Institutes","Institutes");
document.formname.subcategory.options[3]=new Option("Schools","Schools");
document.formname.subcategory.options[4]=new Option("Tuitions","Tuitions");
document.formname.subcategory.options[5]=new Option("Universities","Universities");

break;

case "Books" :
document.formname.subcategory.options[0]=new Option("Select Sub-Category","");
document.formname.subcategory.options[1]=new Option("College Books","College Books");
document.formname.subcategory.options[2]=new Option("Engineering","Engineering");
document.formname.subcategory.options[3]=new Option("Magazines","Magazines");
document.formname.subcategory.options[4]=new Option("Medicine","Medicine");
document.formname.subcategory.options[5]=new Option("References","References");

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="javascript: dropdownlist(this.options[this.selectedIndex].value);">
<option value="">Select Category</option>
<option value="Home Ware">Home Ware</option>
<option value="Education">Education</option>
<option value="Books">Books</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>
  • 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-02T15:04:18+00:00Added an answer on June 2, 2026 at 3:04 pm

    Not sure if you’re looking to actually POST to the form; if not, you can use your Option structure to store your target paths, create a function to navigate to urls, and call from the onChange event of your second dropdown ie:

    <script language="javascript" type="text/javascript">
      function dropdownlist(listindex)
      {
        document.formname.subcategory.options.length = 0;
        switch (listindex)
        {
          case "Home Ware" :
            document.formname.subcategory.options[0]=new Option("Select Sub-Category","");
            document.formname.subcategory.options[1]=new Option("Air-Conditioners/Coolers", "www.google.com");
            document.formname.subcategory.options[2]=new Option("Audio/Video", "www.yahoo.com");
            document.formname.subcategory.options[3]=new Option("Beddings", "www.ikea.com");
            document.formname.subcategory.options[4]=new Option("Camera", "www.apple.com");
            document.formname.subcategory.options[5]=new Option("Cell Phones", "www.sprint.com");
            break;
          case "Education" :
            document.formname.subcategory.options[0]=new Option("Select Sub-Category","");
            document.formname.subcategory.options[1]=new Option("Colleges", "www.aol.com");
            document.formname.subcategory.options[2]=new Option("Institutes", "www.facebook.com");
            document.formname.subcategory.options[3]=new Option("Schools", "www.pintrest.com");
            document.formname.subcategory.options[4]=new Option("Tuitions", "www.lottopick.in");
            document.formname.subcategory.options[5]=new Option("Universities", "www.cnn.com");
            break;
          case "Books" :
            document.formname.subcategory.options[0]=new Option("Select Sub-Category","");
            document.formname.subcategory.options[1]=new Option("College Books","www.oracle.com");
            document.formname.subcategory.options[2]=new Option("Engineering","stackoverflow.com");
            document.formname.subcategory.options[3]=new Option("Magazines","monster.com");
            document.formname.subcategory.options[4]=new Option("Medicine","www.twitter.com");
            document.formname.subcategory.options[5]=new Option("References","www.yelp.com");
            break;
        }
        return true;
      }
    
      function navigate(target){
        window.location.href = 'http://' + target;
      }
    </script>
    

    Also:

        <tr>
          <td align="right" valign="middle">Sub Category : </td>
          <td align="left" valign="middle">
            <select name="subcategory" onchange="javascript:navigate(this.options[this.selectedIndex].value);">
              <option value="">Select Sub-Category</option>
            </select>
          </td>
        </tr>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form like the one below which is posted to contacts.php ,
I have this form tag below where the form submits to itself which I
I have form fields which are checkboxes as below : <input id=abirrules@gmail.com type=checkbox checked=checked
I have this form which allows the input of any product quantity from 1-10:
I wonder whether someone can help me please. I've created this form which allows
I have a form which is given below : <form method=post id=contactForm action=> <fieldset
I would like to do something like below: <form action=www.domain.com?retURL=www.domain2.com?parameter=a method=POST> but this is
Is this below the right way to preload images? I have a table which
I have this live search which works perfect until a company name in my
I have this link that creates a few div's in which a form is

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.