Lamez Posted February 14, 2008 Share Posted February 14, 2008 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? Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 14, 2008 Share Posted February 14, 2008 Do you want each select menu's selected option to alternate; is that what your wanting? Quote Link to comment Share on other sites More sharing options...
Lamez Posted February 14, 2008 Author Share Posted February 14, 2008 yep! Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 14, 2008 Share Posted February 14, 2008 You should be able to do this with JavaScript, but I think the best method would be server side. Quote Link to comment Share on other sites More sharing options...
Lamez Posted February 14, 2008 Author Share Posted February 14, 2008 this is fine, but I have no experience in JS, and I was hoping someone had an example I could use. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 14, 2008 Share Posted February 14, 2008 Is it just 3 select menus or could it be multiple select menus? I need to know; to cater to the js code I am going to write for you. Also; will it always be 2 options only? Quote Link to comment Share on other sites More sharing options...
Lamez Posted February 14, 2008 Author Share Posted February 14, 2008 it is going to be multiple. Yes and only 2 selections in each menu. Thank You Very Very Much! Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 15, 2008 Share Posted February 15, 2008 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> Quote Link to comment Share on other sites More sharing options...
Lamez Posted February 15, 2008 Author Share Posted February 15, 2008 How do these work? Say I selected option one from the first list, does it add the selection to the next list? Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 15, 2008 Share Posted February 15, 2008 Oh - my mistake; are you wanting a chained select menu? Quote Link to comment Share on other sites More sharing options...
Lamez Posted February 15, 2008 Author Share Posted February 15, 2008 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. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted February 15, 2008 Share Posted February 15, 2008 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.