Jump to content

Archived

This topic is now archived and is closed to further replies.

Codeman0013

Database dropdowns...

Recommended Posts

Hey guys right now i have a file that has dropdowns that use javascript and i want to change them to be dependent on teh database like for example, When the user selects the industry from dropdown 1 it will then go to the database and find all the entries with the id from that industry and send them to dropdown 2 which is the product category list. When the user then selects a product category it will move on to the next list based on the id they selected and populate the product list. Would anyone be able to help me edit the js to match this?

[code]addListGroup("vehicles", "industry");

addList("industry", "Select an industry", "", "dummy-maker", 1);
addList("industry", "Agriculture", "Agriculture", "Agriculture");
addList("industry", "Analytical", "Analytical", "Analytical");
addList("industry", "Public Works", "Public Works", "Public Works");

addList("dummy-maker", "Select an industry", "", "dummy-car");

addOption("dummy-car", "Select an industry", "");

addList("Agriculture", "Select a product category", "", "dummy-ag", 1);
addList("Agriculture", "Agriculture Material Application Controllers", "mac", "Agriculture Material Application Controllers");
addList("Agriculture", "Agriculture Grain Analyzers", "ga", "Agriculture Grain Analyzers");
addList("Agriculture", "Soil Compaction Testers", "sct", "Soil Compaction Testers");
addList("Agriculture", "Agriculture Ground Speed Sensors", "gss", "Agriculture Ground Speed Sensors");
addList("Agriculture", "Agriculture Testing Equimpment", "te", "Agriculture Testing Equimpment");
addList("Agriculture", "Guidance Systems", "gs", "Guidance Systems");
addList("Agriculture", "Agriculture Moisture Testers", "mt", "Agriculture Moisture Testers");
addList("Agriculture", "Planter/Grain Drill/Air Cart Monitors", "pgcm", "Planter/Grain Drill/Air Cart Monitors");
addList("Agriculture", "Agriculture Accessories", "acc", "Agriculture Accessories");


addOption("dummy-ag", "Select a product category", "");

addOption("Agriculture Material Application Controllers", "Select a product", "", 1);
addOption("Agriculture Material Application Controllers", "CCS100", "CCS100");
addOption("Agriculture Material Application Controllers", "CMS100", "CMS100");
addOption("Agriculture Material Application Controllers", "IntelliAg", "IntelliAg");
addOption("Agriculture Material Application Controllers", "Land Manager", "Land Manager");
addOption("Agriculture Material Application Controllers", "Land Manager II", "Land Manager II");
addOption("Agriculture Material Application Controllers", "Land Manager SE", "Land Manager SE");

addOption("Agriculture Grain Analyzers", "Select a product", "", 1);
addOption("Agriculture Grain Analyzers", "Instalab 600", "Instalab 600");


addOption("Soil Compaction Testers", "Select a product", "", 1);
addOption("Soil Compaction Testers", "Soil Compaction Tester", "Soil Compaction Tester");

addOption("Agriculture Ground Speed Sensors", "Select a product", "", 1);
addOption("Agriculture Ground Speed Sensors", "Hall Effect Sensor", "Hall Effect Sensor");
addOption("Agriculture Ground Speed Sensors", "iSpeed", "iSpeed");
addOption("Agriculture Ground Speed Sensors", "Radar II", "Radar II");
addOption("Agriculture Ground Speed Sensors", "Radar III", "Radar III");
addOption("Agriculture Ground Speed Sensors", "Universal Speed Sensor", "Universal Speed Sensor");

addOption("Agriculture Testing Equimpment", "Select a product", "", 1);
addOption("Agriculture Testing Equimpment", "Application Rate Sensor Tester", "Application Rate Sensor Tester");
addOption("Agriculture Testing Equimpment", "Seed Simulator", "Seed Simulator");
addOption("Agriculture Testing Equimpment", "Sensor Tester 90", "Sensor Tester 90");
addOption("Agriculture Testing Equimpment", "Vehicle Ground Speed Simulator 200", "Vehicle Ground Speed Simulator 200");

addOption("Guidance Systems", "Select a product", "", 1);
addOption("Guidance Systems", "FieldGuide Lightbar", "FieldGuide Lightbar");

addOption("Agriculture Moisture Testers", "Select a product", "", 1);
addOption("Agriculture Moisture Testers", "Dj C-2000-PKGS1 Cotton Moisture Tester", "Dj C-2000-PKGS1 Cotton Moisture Tester");
addOption("Agriculture Moisture Testers", "Dj F-2000-1235S1 Hay Moisture Tester", "Dj F-2000-1235S1 Hay Moisture Tester");
addOption("Agriculture Moisture Testers", "Dj FX-2000S1 Hay Moisture Tester", "Dj FX-2000S1 Hay Moisture Tester");
addOption("Agriculture Moisture Testers", "GAC2100 Agri", "GAC2100 Agri");
addOption("Agriculture Moisture Testers", "GAC500 XT", "GAC500 XT");
addOption("Agriculture Moisture Testers", "Harvest Hand", "Harvest Hand");
addOption("Agriculture Moisture Testers", "M20P", "M20P");
addOption("Agriculture Moisture Testers", "M3G", "M3G");

addOption("Planter/Grain Drill/Air Cart Monitors", "Select a product", "", 1);
addOption("Planter/Grain Drill/Air Cart Monitors", "DjASM II", "DjASM II");
addOption("Planter/Grain Drill/Air Cart Monitors", "DM100", "DM100");
addOption("Planter/Grain Drill/Air Cart Monitors", "PM100 and PM100E", "PM100 and PM100E");
addOption("Planter/Grain Drill/Air Cart Monitors", "PM300", "PM300");
addOption("Planter/Grain Drill/Air Cart Monitors", "PM400", "PM400");
addOption("Planter/Grain Drill/Air Cart Monitors", "PM500", "PM500");
addOption("Planter/Grain Drill/Air Cart Monitors", "Seed Manager SE", "Seed Manager SE");

addOption("Agriculture Accessories", "Select a product", "", 1);
addOption("Agriculture Accessories", "10-Inch Handle Prod", "10-Inch Handle Prod");
addOption("Agriculture Accessories", "10-Inch Prod", "10-Inch Prod");
addOption("Agriculture Accessories", "18-Inch Handle Prod", "18-Inch Handle Prod");
addOption("Agriculture Accessories", "36-Inch Handle Prod", "36-Inch Handle Prod");
addOption("Agriculture Accessories", "36-Inch T-Handle", "36-Inch T-Handle");
addOption("Agriculture Accessories", "Accessory Module", "Accessory Module");
addOption("Agriculture Accessories", "Air Pressure Sensor", "Air Pressure Sensor");
addOption("Agriculture Accessories", "Application Rate Sensor", "Application Rate Sensor");
addOption("Agriculture Accessories", "Baled Fiber Probe", "Baled Fiber Probe");
addOption("Agriculture Accessories", "Baler Sensor", "Baler Sensor");
addOption("Agriculture Accessories", "Boom Controller", "Boom Controller");
addOption("Agriculture Accessories", "Carrying Case", "Carrying Case");
addOption("Agriculture Accessories", "Cone & Skein Fiber Probe", "Cone & Skein Fiber Probe");
addOption("Agriculture Accessories", "Continental Magnum Equalizer NH3 Heat Exchanger System/Kit", "Continental Magnum Equalizer NH3 Heat Exchanger System/Kit");
addOption("Agriculture Accessories", "Cotton Ball Cup", "Cotton Ball Cup");
addOption("Agriculture Accessories", "Flow Meters", "Flow Meters");
addOption("Agriculture Accessories", "Hall Effect Sensor", "Hall Effect Sensor");
addOption("Agriculture Accessories", "Handle", "Handle");
addOption("Agriculture Accessories", "High-Rate Seed Sensor", "High-Rate Seed Sensor");
addOption("Agriculture Accessories", "Hopper Level Sensor", "Hopper Level Sensor");
addOption("Agriculture Accessories", "Implement Lift Switch", "Implement Lift Switch");
addOption("Agriculture Accessories", "Liquid Flow Control Valves", "Liquid Flow Control Valves");
addOption("Agriculture Accessories", "Liquid Pressure Sensor", "Liquid Pressure Sensor");
addOption("Agriculture Accessories", "Proportional Hydraulic Flow Control Valves", "Proportional Hydraulic Flow Control Valves");
addOption("Agriculture Accessories", "Recon Flow Sensor", "Recon Flow Sensor");
addOption("Agriculture Accessories", "Servo Hydraulic Flow Control Valves", "Servo Hydraulic Flow Control Valves");
addOption("Agriculture Accessories", "Short-Pin Prod", "Short-Pin Prod");
addOption("Agriculture Accessories", "Split Baler Sensor", "Split Baler Sensor");
addOption("Agriculture Accessories", "Strap-On Recon Flow Sensor", "Strap-On Recon Flow Sensor");
addOption("Agriculture Accessories", "TSM-10 Tachometer Shaft Monitor/Speed-Engine Hour Indicator", "TSM-10 Tachometer Shaft Monitor/Speed-Engine Hour Indicator");
addOption("Agriculture Accessories", "Valve Actuator", "Valve Actuator");
addOption("Agriculture Accessories", "Vapor/Bubble Detector", "Vapor/Bubble Detector");

addList("Analytical", "Select product category", "", "dummy-an", 1);
addList("Analytical", "Analytical Moisture Testers", "amt", "Analytical Moisture Testers");
addList("Analytical", "Analytical Grain Analyzers", "ga", "Analytical Grain Analyzers");
addList("Analytical", "Dewpoint Detectors", "dpt", "Dewpoint Detectors");
addList("Analytical", "Analytical Accessories", "acc", "Analytical Accessories");

addOption("dummy-an", "Select a product category", "");

addOption("Analytical Moisture Testers", "Select a product", "", 1);
addOption("Analytical Moisture Testers", "Dj C-2000-PKGS1 Cotton Moisture Tester", "Dj C-2000-PKGS1 Cotton Moisture Tester");
addOption("Analytical Moisture Testers", "Dj F-2000-1235S1 Hay Moisture Tester", "Dj F-2000-1235S1 Hay Moisture Tester");
addOption("Analytical Moisture Testers", "Dj FX-2000S1 Hay Moisture Tester", "Dj FX-2000S1 Hay Moisture Tester");
addOption("Analytical Moisture Testers", "GAC2100 Agri", "GAC2100 Agri");
addOption("Analytical Moisture Testers", "GAC2100 GI", "GAC2100 GI");
addOption("Analytical Moisture Testers", "GAC2100b", "GAC2100b");
addOption("Analytical Moisture Testers", "GAC500 XT", "GAC500 XT");

addOption("Analytical Grain Analyzers", "Select a product", "", 1);
addOption("Analytical Grain Analyzers", "Instalab 600", "Instalab 600");
addOption("Analytical Grain Analyzers", "OmegAnalyzer G", "OmegAnalyzer G");

addOption("Dewpoint Detectors", "Select a product", "", 1);
addOption("Dewpoint Detectors", "Alnor Dewpointer", "Alnor Dewpointer");

addOption("Analytical Accessories", "Select a product", "", 1);
addOption("Analytical Accessories", "10-Inch Handle Prod", "10-Inch Handle Prod");
addOption("Analytical Accessories", "10-Inch Prod", "10-Inch Prod");
addOption("Analytical Accessories", "18-Inch Handle Prod", "18-Inch Handle Prod");
addOption("Analytical Accessories", "36-Inch Handle Prod", "36-Inch Handle Prod");
addOption("Analytical Accessories", "36-Inch T-Handle", "36-Inch T-Handle");
addOption("Analytical Accessories", "Baled Fiber Probe", "Baled Fiber Probe");
addOption("Analytical Accessories", "Baler Sensor", "Baler Sensor");
addOption("Analytical Accessories", "Carrying Case", "Carrying Case");
addOption("Analytical Accessories", "Cone & Skein Fiber Probe", "Cone & Skein Fiber Probe");
addOption("Analytical Accessories", "Cotton Ball Cup", "Cotton Ball Cup");
addOption("Analytical Accessories", "Handle", "Handle");
addOption("Analytical Accessories", "Short-Pin Prod", "Short-Pin Prod");
addOption("Analytical Accessories", "Split Baler Sensor", "Split Baler Sensor");

addList("Public Works", "Select product category", "", "dummy-pw", 1);
addList("Public Works", "Public Works Material Application Controllers", "pwmac", "Public Works Material Application Controllers");
addList("Public Works", "Automatic Vehicle Locators", "avl", "Automatic Vehicle Locators");
addList("Public Works", "Proportional Joystick Controllers", "pjc", "Proportional Joystick Controllers");
addList("Public Works", "Public Works Ground Speed Sensors", "pwgss", "Public Works Ground Speed Sensors");
addList("Public Works", "Public Works Accessories", "pwacc", "Public Works Accessories");
addList("Public Works", "Public Works Testing Equimpment", "pwte", "Public Works Testing Equimpment");
addList("Public Works", "Ground Speed Adapters", "gsa", "Ground Speed Adapters");

addOption("dummy-pw", "Select a product category", "");

addOption("Public Works Material Application Controllers", "Select a product", "", 1);
addOption("Public Works Material Application Controllers", "CCS100 Application Controller", "CCS100 Application Controller");
addOption("Public Works Material Application Controllers", "CMS100 Application Monitor", "CMS100 Application Monitor");
addOption("Public Works Material Application Controllers", "Control Point Control System", "Control Point Control System");
addOption("Public Works Material Application Controllers", "ICS2000 Control System", "ICS2000 Control System");
addOption("Public Works Material Application Controllers", "LT Control Application Controller", "LT Control Application Controller");

addOption("Automatic Vehicle Locators", "Select a product", "", 1);
addOption("Automatic Vehicle Locators", "Fleet Finder Automatic Vehicle Locator", "Fleet Finder Automatic Vehicle Locator");


addOption("Proportional Joystick Controllers", "Select a product", "", 1);
addOption("Proportional Joystick Controllers", "ControlKING Proportional Joystick Controller", "ControlKING Proportional Joystick Controller");


addOption("Public Works Ground Speed Sensors", "Select a product", "", 1);
addOption("Public Works Ground Speed Sensors", "iSpeed", "iSpeed");
addOption("Public Works Ground Speed Sensors", "Mechanical Speedometer Sensor", "Mechanical Speedometer Sensor");
addOption("Public Works Ground Speed Sensors", "Radar II", "Radar II");
addOption("Public Works Ground Speed Sensors", "Radar III", "Radar III");

addOption("Public Works Accessories", "Select a product", "", 1);
addOption("Public Works Accessories", "12-Volt Valve Relay Driver", "12-Volt Valve Relay Driver");
addOption("Public Works Accessories", "Application Rate Sensor", "Application Rate Sensor");
addOption("Public Works Accessories", "Boom Controller", "Boom Controller");
addOption("Public Works Accessories", "Calibration Keyboard", "Calibration Keyboard");
addOption("Public Works Accessories", "DaRT Data Retrieval Tool", "DaRT Data Retrieval Tool");
addOption("Public Works Accessories", "Down Pressure Sensor", "Down Pressure Sensor");
addOption("Public Works Accessories", "Dual Drop-On Valve Actuator", "Dual Drop-On Valve Actuator");
addOption("Public Works Accessories", "Dual Pulse-Width Modulated Valve Driver", "Dual Pulse-Width Modulated Valve Driver");
addOption("Public Works Accessories", "Flow Meters", "Flow Meters");
addOption("Public Works Accessories", "Gate Height Sensor", "Gate Height Sensor");
addOption("Public Works Accessories", "Hopper Level Sensor", "Hopper Level Sensor");
addOption("Public Works Accessories", "Liquid Flow Control Valves", "Liquid Flow Control Valves");
addOption("Public Works Accessories", "Liquid Pressure Sensor", "Liquid Pressure Sensor");
addOption("Public Works Accessories", "Prewet Anti-Ice Switch", "Prewet Anti-Ice Switch");
addOption("Public Works Accessories", "Proportional Hydraulic Flow Control Valves", "Proportional Hydraulic Flow Control Valves");
addOption("Public Works Accessories", "Proportional Hydraulic Spreader Control Valve", "Proportional Hydraulic Spreader Control Valve");
addOption("Public Works Accessories", "Remote Blast Switch", "Remote Blast Switch");
addOption("Public Works Accessories", "Road Watch Pavement and Air Temperature Sensor", "Road Watch Pavement and Air Temperature Sensor");
addOption("Public Works Accessories", "Rotary Flow Meters", "Rotary Flow Meters");
addOption("Public Works Accessories", "Servo Hydraulic Flow Control Valves", "Servo Hydraulic Flow Control Valves");
addOption("Public Works Accessories", "Spinner RPM Sensor", "Spinner RPM Sensor");
addOption("Public Works Accessories", "Universal Printer", "Universal Printer");
addOption("Public Works Accessories", "Valve Actuator", "Valve Actuator");


addOption("Public Works Testing Equimpment", "Select a product", "", 1);
addOption("Public Works Testing Equimpment", "Application Rate Sensor Tester", "Application Rate Sensor Tester");
addOption("Public Works Testing Equimpment", "Universal Proportional Simulator", "Universal Proportional Simulator");
addOption("Public Works Testing Equimpment", "Vehicle Ground Speed Simulator 200", "Vehicle Ground Speed Simulator 200");

addOption("Ground Speed Adapters", "Select a product", "", 1);
addOption("Ground Speed Adapters", "Chevy/Dodge/Ford/GMC (Spade Terminal)", "Chevy/Dodge/Ford/GMC (Spade Terminal)");
addOption("Ground Speed Adapters", "Chevy/Dodge/Ford/GMC (Weather Pack Connector)", "Chevy/Dodge/Ford/GMC (Weather Pack Connector)");
addOption("Ground Speed Adapters", "Ground Speed Isolation Buffer", "Ground Speed Isolation Buffer");
addOption("Ground Speed Adapters", "International/Ford", "International/Ford");
addOption("Ground Speed Adapters", "Manual Transmission (Deutsch Connector)", "Manual Transmission (Deutsch Connector)");
addOption("Ground Speed Adapters", "Non-World Transmission (Beede/Ford)", "Non-World Transmission (Beede/Ford)");
addOption("Ground Speed Adapters", "Non-World Transmission (Metrapack Connector)", "Non-World Transmission (Metrapack Connector)");
addOption("Ground Speed Adapters", "World Transmission (Fly Lead)", "World Transmission (Fly Lead)");
addOption("Ground Speed Adapters", "World Transmission (Non-Fly Lead)", "World Transmission (Non-Fly Lead)");
addOption("Ground Speed Adapters", "World Transmission (Ring Terminal)", "World Transmission (Ring Terminal)");[/code]

Share this post


Link to post
Share on other sites
Have a look at the baaSelect class in my sig. It extracts db data to create cascading dropdowms and gnerates the js arrays and scripts to handle the selections from the menus

Share this post


Link to post
Share on other sites

×

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.