troubleshooting Question

Dynamically populating 3 select boxes

Avatar of StellaBob
StellaBobFlag for United States of America asked on
JavaScriptMicrosoft SQL Server
14 Comments1 Solution114 ViewsLast Modified:
I currently have a website where visitors select a country drop down, which, based on their selection, populates the state drop down, then if they select a state, it populates a City drop down. The site's old, but the JavaScript still works.  I'm working on a new, responsive website, but this functionality isn't working.  It appears to be rendering queries properly and pulling the data that 'should' be accessed by the script, but the state/city drop downs are not working.  Here's the page where the selects work properly:  

So here's my question for those of you who work in JavaScript.  The drop downs in the page I linked to above pulls 3 queries from 3 different tables.  A country table, a state table, and a city table.  These are connected by their respective 'IDs'.  So when you view the source, you'll see this scenario for each of the states.  The first numbers are the state IDS, and the "1" is the ID for for the country:

                 arrItems1['3'] = "AK";
             arrItemsGrp1['3'] = "1";
             arrItems1['198'] = "AK";
             arrItemsGrp1['198'] = "1";
             arrItems1['220'] = "AK";
             arrItemsGrp1['220'] = "1";
             arrItems1['221'] = "AK";
             arrItemsGrp1['221'] = "1";
             arrItems1['222'] = "AK";
             arrItemsGrp1['222'] = "1";

You'll see similar code for the states.  In my new version, I did what many of you would probably consider a no-no, but since the individual updating the data messsed it up so bad, I just have one table that contains one record for each dealer and instead of having fields that hold city/state/country IDs to connect to the other tables, I just included the city/state/country names in the table.  So, in the new scenario, the 3 queries pull and group things based on the actual city/state/country name.  So there are no 'IDs'.  So basically, what you see above, no renders like this:

                                 arrItems1['AK'] = "AK";
                         arrItemsGrp1['AK'] = "United States";
                         arrItems1['AL'] = "AL";
                         arrItemsGrp1['AL'] = "United States";
                         arrItems1['AR'] = "AR";
                         arrItemsGrp1['AR'] = "United States";
                         arrItems1['AZ'] = "AZ";
                         arrItemsGrp1['AZ'] = "United States";

So...would this be why it doesn't work?  I don't know JavaScript to understand if the code is looking for numbers versus text.  If that doesn't matter, what would you need from me to help me further?

Let me know.  Thanks.
Kim Walker
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros