...

View Full Version : Resolved how to make a "find sales rep" page?



samuelito.mcf
01-23-2013, 12:45 AM
I want to make a web page that has a drop down where people can select there state. Then once they do I want the page to change somehow not necessarily into a new page but so that it has another drop down so they can select their city. Then once they do that it shows the sales reps in their area. How exactly would I go about this? I'm good with html and css but beyond that I need assistance haha so any javascript explanations pertaining to this would be great!

niralsoni
01-23-2013, 02:43 PM
Well, you can achieve this by making use of the AJAX call to your server where details related to states, cities and sales representatives are stored.

Logic will be to call a JavaScript function onChange of the drop-down box. This function will make an AJAX call to your server, which, in turn, will respond with the required data (probably in JSON/XML format). Then, dynamically create new drop-down boxes and populate the data.

For more information on AJAX, check http://www.w3schools.com/ajax/default.asp

Regards,
Niral Soni

jerry62704
01-23-2013, 03:21 PM
You can do this in CSS (see drop down menus), but it would require way too much typing in my opinion. Every city for every state?

You can do it with a database and server side processing via PHP for example. Or you could do it with a database and server side processing on one element via ajax.

A Google of "database of states and cities" returned 63M responses.

samuelito.mcf
01-23-2013, 08:22 PM
Before I read your responses I found somewhat of a solution here: http://stackoverflow.com/questions/11787272/how-to-create-dropdown-menu-that-appears-based-on-answer-from-another-dropdown-m

It's working until I get to the second selection. Some of my reps cover a whole state so when they select their state it displays the rep information; working perfectly. But others are divided into more specific areas so I have another drop down that appears when they select their state that they then can select their area. The problem is I can't get it to work where after choosing their area the rep info appears. Any help? I tried adding additional script so that the var selectop was different so it pulled from different options but my little knowledge of javascript is making things difficult.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum