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 6344741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:41:59+00:00 2026-05-24T20:41:59+00:00

I am not really a web person and am having trouble creating a cascading

  • 0

I am not really a web person and am having trouble creating a cascading combo box. I have my options, but when I cannot figure out how to do a JavaScript command to switch the second box depending on the first box’s selection.

These are my first set of options:

<select id="searchType" onchange="selectedOption(this)">
  <option value="sessions">Sessions</option>
  <option value="files">Files</option>
  <option value="clients">Clients</option>
</select>

Depending on what they click there I would like to show these set of options:

SESSIONS

<select id="secondOptions">
   <option value="conf">Config ID</option>
   <option value="length">Length</option>
   <option value="date">Date</option>
</select>

FILES

<select id="secondOptions">
       <option value="id">File ID</option>
       <option value="length">Length</option>
       <option value="sent">Sent</option>
       <option value="sessionId">Session ID</option>
</select>

CLIENTS

<select id="secondOptions">
       <option value="name">Client Name</option>
       <option value="organization">Organization</option>
       <option value="specialty">Specialty</option>
       <option value="sessionId">Session ID</option>
</select>

And finally a textbox to type into to really specify the search.
Once again, I am trying to do this using JavaScript, but if there is a better way to do this let me know please.

  • 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-05-24T20:42:01+00:00Added an answer on May 24, 2026 at 8:42 pm

    Given the amended html mark-up:

    <form action="#" method="post">
        <select id="searchType">
            <option value="sessions">Sessions</option>
            <option value="files">Files</option>
            <option value="clients">Clients</option>
        </select>
    
        <select id="sessions">
            <option value="conf">Config ID</option>
            <option value="length">Length</option>
            <option value="date">Date</option>
        </select>
    
        <select id="files">
            <option value="id">File ID</option>
            <option value="length">Length</option>
            <option value="sent">Sent</option>
            <option value="sessionId">Session ID</option>
        </select>
    
        <select id="clients">
            <option value="name">Client Name</option>
            <option value="organization">Organization</option>
            <option value="specialty">Specialty</option>
            <option value="sessionId">Session ID</option>
        </select>
    
        <fieldset id="textAreaSearchBox">
            <legend>Search:</legend>
            <textarea></textarea>
        </fieldset>
    </form>
    

    (Note the changed ids, wrapping the form elements in a form, the addition of a fieldset, legend and textarea in the mark-up), the following JavaScript seems to work:

    var select1 = document.getElementById('searchType');
    var selects = document.getElementsByTagName('select');
    
    select1.onchange = function() {
        var select2 = this.value.toLowerCase();
        for (i = 0; i < selects.length; i++) {
            if (selects[i].id != this.id) {
                selects[i].style.display = 'none';
            }
        }
        document.getElementById(select2).style.display = 'block';
        document.getElementById('textAreaSearchBox').style.display = 'block';
    };
    

    JS Fiddle demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have web application and I do not really care about IE6 users. However
Not really a programming question, but relevant to many programmers... Let's say I have
I have searched the forums and all over the web and have not really
Do not really know how x509 works. If I have a Web Service that
I am not really familiar with Maven program but I've been using Eclipse for
I have started in web development not long time ago. I know some stuff
I'm not really sure if I'm using the WebImage class correctly. I have a
I'm in the process of rewriting a web application (i.e. not web page, but
I have a little problem and because my WEB development skills are not the
I'm not really a server-side person – I generally do iPhone apps, though I've

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.