2 drop down menus

  • Cae
  • Expert
  • Expert
  • User avatar
  • Posts: 734

Post 3+ Months Ago

ok, what i want to do is create 2 drop down menus, one with graduation years in it, the other with student names in it...

i want to use a database to get the values for the menus (i know hoe to do this)... but i want to have it so that when you select a year in the first menu, it sets the values in the second menu to the students in the corrosponding grad year... problem is i have no idea how do this... i know it is possible, ive seen it before... any suggestions?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Cae
  • Expert
  • Expert
  • User avatar
  • Posts: 734

Post 3+ Months Ago

even better... as opposed to drop-down menus, idealy id like to have something like this: http://www.csd.toshiba.com/cgi-bin/tais/pc/pd/st/st_modelAccCompatSel.jsp?BV_SessionID=@@@@1609748479.1080598988@@@@&BV_EngineID=ccciadcldiihlmecgfkceghdgngdglj.0&comm=ST, only with two boxes however...
  • conorific
  • Proficient
  • Proficient
  • User avatar
  • Posts: 350
  • Loc: NY

Post 3+ Months Ago

Well, looking at the source, it's a JavaScript thing. You could Google this, but you may want to consider that some users have JS turned off in their browsers...
  • Cae
  • Expert
  • Expert
  • User avatar
  • Posts: 734

Post 3+ Months Ago

currently it is an internal site, i know all the computers have JS enabled on them because i enabled them, also, if they admin ppls ever decided to open the site to the general public, the main site for the school is javascript, so... yeah...

additionally, i have been looking at the source for the page...

i know this is where the menues come from: line 27
Code: [ Select ]
var laProduct = new Array();
laProduct[0] = new Product();
laProduct[0].NAME ='Desktops';
laProduct[0].PRODUCTLINE ='119522';
laProduct[0].Model = new Array();
laProduct[0].Model[0]= new Model();
laProduct[0].Model[0].NAME ='Equium';
laProduct[0].Model[0].Sku = new Array();
laProduct[0].Model[0].Sku[0] = new Sku();
laProduct[0].Model[0].Sku[0].NAME ='100';
laProduct[0].Model[0].Sku[0].OID ='1073769587';
...
  1. var laProduct = new Array();
  2. laProduct[0] = new Product();
  3. laProduct[0].NAME ='Desktops';
  4. laProduct[0].PRODUCTLINE ='119522';
  5. laProduct[0].Model = new Array();
  6. laProduct[0].Model[0]= new Model();
  7. laProduct[0].Model[0].NAME ='Equium';
  8. laProduct[0].Model[0].Sku = new Array();
  9. laProduct[0].Model[0].Sku[0] = new Sku();
  10. laProduct[0].Model[0].Sku[0].NAME ='100';
  11. laProduct[0].Model[0].Sku[0].OID ='1073769587';
  12. ...


however, i do not understand why it is generating new objects for every product, model, and sku... the only thing i could think of is that they are those sub-arrays???

also, i know this is the part where the menuse are changed (slightly condensed..) line 2773:
Code: [ Select ]
changeMenu(cm){

    var selectedProduct = "";
    var selectedProductIndex = -1;
    var selectedModel = "";
    var selectedModelIndex = -1;
    
    var modelCount = findStudent[selectedProductIndex].Model.length;
    for (i = 0; i < modelCount; i++){
        var modelName = laProduct[selectedProductIndex].Model[i].NAME;
        laProductMenu[cm + 1].options[i] = new Option(modelName, modelName);
    }
    laProductMenu[cm + 1].length = modelCount;    
        //When a Family is selected, clear out the SKU Menu
        laProductMenu[cm + 2].length = 1;
        laProductMenu[cm + 2].options[0] = new Option("--------------------","");
}

</script>
  1. changeMenu(cm){
  2.     var selectedProduct = "";
  3.     var selectedProductIndex = -1;
  4.     var selectedModel = "";
  5.     var selectedModelIndex = -1;
  6.     
  7.     var modelCount = findStudent[selectedProductIndex].Model.length;
  8.     for (i = 0; i < modelCount; i++){
  9.         var modelName = laProduct[selectedProductIndex].Model[i].NAME;
  10.         laProductMenu[cm + 1].options[i] = new Option(modelName, modelName);
  11.     }
  12.     laProductMenu[cm + 1].length = modelCount;    
  13.         //When a Family is selected, clear out the SKU Menu
  14.         laProductMenu[cm + 2].length = 1;
  15.         laProductMenu[cm + 2].options[0] = new Option("--------------------","");
  16. }
  17. </script>


but i havent found how they get the original/primary/catagory menu menu in there...

meh... this is confusing the hell out of me!!!
  • conorific
  • Proficient
  • Proficient
  • User avatar
  • Posts: 350
  • Loc: NY

Post 3+ Months Ago

I suggest Googling it, you can find a lot that way. First we have to know what they call that menu and that I don't know...so someone else will have to step in from here.

JavaScript is not my thing so I can't really help you and for that, I apologize. I'm such a loser.

Someone will answer, though, they always do. :)
  • Cae
  • Expert
  • Expert
  • User avatar
  • Posts: 734

Post 3+ Months Ago

sorry, just edited my post up there... all the code portions are edits...

and i am doing a search on google as i type.. im just having trouble finding relevant stuff...
  • Cae
  • Expert
  • Expert
  • User avatar
  • Posts: 734

Post 3+ Months Ago

ok, is there simply a way i can make a 2 dimensional array called say student[x,y] with x being their grad year, and y being thier name, and then have the 'onClick' command in the select statement go and call a function which then goes and writes the select statement for the second menu going through all the y values for the student array, for the grad year?

the other problem i am having is that i cant seem to figure out how the are re-writing the select menus...
  • Cae
  • Expert
  • Expert
  • User avatar
  • Posts: 734

Post 3+ Months Ago

ummmm... right... thanx for your help everyone i guess... i figured it out... took about 6 hours of staring at source and documentation, but i figured it out...

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 94 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.