Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2013
    Location
    Oregon
    Posts
    34
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question how to make a "find sales rep" page?

    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!
    Last edited by samuelito.mcf; 01-23-2013 at 10:39 PM.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    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

  • #3
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    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.
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #4
    New Coder
    Join Date
    Jan 2013
    Location
    Oregon
    Posts
    34
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Before I read your responses I found somewhat of a solution here: http://stackoverflow.com/questions/1...her-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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •