Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-22-2013, 11:45 PM   PM User | #1
samuelito.mcf
New Coder

 
Join Date: Jan 2013
Location: Oregon
Posts: 34
Thanks: 5
Thanked 0 Times in 0 Posts
samuelito.mcf is an unknown quantity at this point
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 09:39 PM..
samuelito.mcf is offline   Reply With Quote
Old 01-23-2013, 01:43 PM   PM User | #2
niralsoni
Regular Coder

 
Join Date: Mar 2008
Location: London
Posts: 129
Thanks: 1
Thanked 31 Times in 31 Posts
niralsoni is an unknown quantity at this point
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
niralsoni is offline   Reply With Quote
Old 01-23-2013, 02:21 PM   PM User | #3
jerry62704
Senior Coder

 
jerry62704's Avatar
 
Join Date: Oct 2007
Location: Springfield, IL
Posts: 1,042
Thanks: 9
Thanked 81 Times in 81 Posts
jerry62704 is on a distinguished road
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
jerry62704 is online now   Reply With Quote
Old 01-23-2013, 07:22 PM   PM User | #4
samuelito.mcf
New Coder

 
Join Date: Jan 2013
Location: Oregon
Posts: 34
Thanks: 5
Thanked 0 Times in 0 Posts
samuelito.mcf is an unknown quantity at this point
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.
samuelito.mcf is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:36 PM.


Advertisement
Log in to turn off these ads.