Jump to content

Dropdown Boxes


Lamez

Recommended Posts

Alright,

I am making a bracket system, and I want it to add the selection to the next drop down box, but I need to be able to process the picks as a php variable, but I can do that part.

 

How can I do this:

Round 1

Team A

Team B *User selected*

 

Round 2

Team B *User selected*

Team C

 

Round 3

Team B

Team D *user selected

 

and so on..

 

What is this called? How can I do it?

Link to comment
Share on other sites

 

Here is a basic demo; it's got an error (which there is a odd number of select menus) which I am still working on, but it does work. If you will give me a little bit; I will figure out the error and correct it.

 

<select>
<option></option>
<option>One</option>
<option>Two</option>
</select>

<select>
<option></option>
<option>One</option>
<option>Two</option>
</select>

<select>
<option></option>
<option>One</option>
<option>Two</option>
</select>

<select>
<option></option>
<option>One</option>
<option>Two</option>
</select>

<select>
<option></option>
<option>One</option>
<option>Two</option>
</select>

<select>
<option></option>
<option>One</option>
<option>Two</option>
</select>


<script language="javascript">

var max = document.getElementsByTagName('option').length;

for(i=0;i<max;i++)
{
if (i%2) {
i=i+2;
document.getElementsByTagName('option')[i].selected = true;
}
else {
i=i+1;
document.getElementsByTagName('option')[i].selected = true;
}
}

</script>

 

 

Link to comment
Share on other sites

Well sorta

 

I want 2 options in one list box.

 

1 option is pre-made, and the other option is made from the selection in the previous box

 

Example:

 

Box 1:

Option 1

Option 2 (user selected this option, add it to the next list)

 

Box 2:

Option 2

Option 3 (user selected this option, add it to the next list)

 

Box 3:

Option 3 (user selected this option, add it to the next list)

Option 4

 

Box 4:

Option 3 (user selected this option, add it to the next list)

Option 5

 

and so on..

 

I am really not sure how to go about this.

 

Link to comment
Share on other sites

 

This may help you see how to add options to a select menu:

 

http://javascript.internet.com/forms/adding-options.html

 

If not; Google something like "adding select menu options with javascript"; that should return you several examples of adding options to a select menu.

 

You also may want to Google "JavaScript Chained Select Menus".

 

Hope This Helps ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.