Trouble With Three Dependent Drop Down Boxes - Using ASP, Javascript, AJAX

Hi,
I know this question has been answered in various ways, though there never quite what im looking for. Im happy to receive help/solutions in any combination of asp/ajax/javascript. Some advice on which option would be best, i've seen javascript examples where all the data is collected and all the options are done in one hit, or asp where after each selection is made a call back to the server to update the next box is done. My database will pull out up to 500 records maximum.

So this is what I'm trying to achieve;
( Currently all this is in the one table, I have seen examples that use seperate tables and join them, but due to limited knowledge i've been unable to modify them)

From the Access table there are three select boxes that I need to populate;

1st Select Box = Manufacturers
Gather all manufactuers, only need one of each name, so I did try SELECT DISTINCT

2nd Select Box = Models
Gather all models in relation to the selection made in Select Box(Manufacturers). Again only show one of each model

3rd Select Box = Deriative
Similar to the others grab all deriatives that relate to the selection made in Select Box(Models)

I have found something here on EE which maybe what I'm looking for, but I seem to get a javascript error. i would post the code but it is in EE Members only, the link, https://filedb.experts-exchange.com/incoming/ee-stuff/4370-dbfun_ajax.zip.

Advice or good examples of this would be appreciated

Dan
DanielR6Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlemusCommented:
Try this
http://forums.aspfree.com/code-bank-54/dynamic-triple-linked-dropdowns-99849.html

I use a variation that only links two, but it works great.
b0lsc0ttIT ManagerCommented:
DanielR6,

Thanks for your interest in my work. :)  The ee-stuff file is one I uploaded.  I see you already have an  expert response and am not sure if you need more but that file was for the closed question at http:/Q_22770695.html .  If the comment above doesn't provide all you need or you have a question about doing this then let me know.  Enjoy this project, it sounds fun. :)

b0lsc0tt
DanielR6Author Commented:
Thanks Alemus for that link. I given it a try and it seems to work fine.

Dan
Maximize Customer Retention with Superior Service

The IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more to help build customer satisfaction and retention.

DanielR6Author Commented:
b0lsc0tt

Thank you for your reply, I noticed that it was your work I had stumbled onto, Im reasonably new to EE and was looking for a way to get in contact with you for some advice, but it seems they dont have a way of internally contacting other members, or have I missed something?
The previous example from Alemus, and I certainly don't want to sound ungrateful here works fine and was running within minutes, but Im interest in progressing with your example for my project.

I am in need of a little helping hand, I seem to be struggling to alter the sql in order to get the required results from a single table rather than joining two seperate ones. I dont know whether my first posting provides enough info for you to go on so heres an update

My database holds around 400 - 500 records. The three columns that I'm interested in are stk_Manufacturers, stk_Model, stk_Deriative, as from that posting i trying to get them to relate as such. So far all I've manged is to get the first drop down populated, however if I try to do a SELECT DISTINCT it returns nothing!!

Help on this would be greatly received
Dan
DanielR6Author Commented:
b0lsc0tt

Would you mind giving me some assistance with this project, I still seem to be incorrect with the SQL.

Thanks
Dan
b0lsc0ttIT ManagerCommented:
Dan,
I will be glad to.  Some work projects, etc have taken me away from EE so I haven't had a chance to look over your response yet.  I hope to a little later today (unless a new thing comes up).
bol
b0lsc0ttIT ManagerCommented:
I think I will need more info.  Thanks for what you have provided though.
How are you using Select Distinct?  I am not sure why you would need it and so curious what you SQL query is like and the data in the DB for those fields.  The first pull down fills from the start, correct?  Are you able to select and item in it (Manufacturers) and then have the Models list populate?  Are they the correct results?
Did my files work for you just as they were in the zip (maybe a modification for the connection, etc)?
What is the script error you mentioned?  Please provide details on the error message, the code for that part of the page and any other info like it.
The records in that DB were few if I remember right but the fact you have 400-500 should not change the basic steps you can use.  Those pages should show that but uses a simple table and example to do it.  Adapting it for a real example will hopefully still be easy but I guess I am a little unclear exactly where the problem is.  If you can provide those details we should be able to help.  Let me know if you have a question about anything I have said.
bol
DanielR6Author Commented:
b0lsc0tt

Sorry about the delay in getting back to you, work has been hectic.

It must have been something I done, as after downloading them again they worked fine.

I've had a play around with your example and I seem to have got it working correctly. One question though, the dropdowns in this example are displayed as you select the previous option, is it possible to alter them so that all three dropdowns are displayed initially but the second and third would be greyed out and unselectable until a selection is made from the first, then second etc. I know that this purely for aesthetics but if you know a way or have seen an example, I would be great full

Thanks
Dan
b0lsc0ttIT ManagerCommented:
>> work has been hectic <<
Same here.  I hadn't even noticed. :)  Thanks for the apology though.
>> after downloading them again they worked fine <<
Great!
>> is it possible to alter them so that all three dropdowns are displayed initially but the second and third would be greyed out and unselectable until a selection is made from the first, then second etc <<
That is definitely possible.  This usually involves a little more Javascript but it can be done and is often done that way.  I can help with specifics but your .html page (or the main page) would have the form and all the fields just as you want and described.  The second and third would not have any options in them except maybe a first, default option.  They can be disabled easily just using the tag's attribute.
The server script would now send just the info for the option to the AJAX script.  In other words instead of html for a select and options you might send just a string or JSON with the name and value for each option.  No html.  The Javascript gets that response, processes the info, uses the DOM to add the option tags, and then enables the select.
I can help with specifics if you need them.  I won't have time til later tonight to do a lot so let me know what details you will need, if any.  Some of the above I would expect you can do on your own now that you know what is needed and the steps.  If you have a question about anything I have said then let me know.
bol
b0lsc0ttIT ManagerCommented:
I have modified the code to show how this could be done.  It is a basic example and improvements could be made to the pages but it does show what you asked here.  Let me know if you have a question.
I placed the files on EE-stuff since EE doesn't yet allow ASP or a HTML file, even if in a ZIP file.  The file is at https://filedb.experts-exchange.com/incoming/ee-stuff/7421-dbfunredux_ajax.zip .
bol

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DanielR6Author Commented:
Thank you bol for your time in modifying the code, due to christmas duties I've only just had chance to do some work on the project and have a look over your changes. If I get any issues tho i'll let you know.

Dan
b0lsc0ttIT ManagerCommented:
I am glad you were able to come back.  Let me know how that helps or if you have a question.
bol
DanielR6Author Commented:
Hi bol
Hope you had a good festive period

I've been spending some time working on this, but seem to be experiencing problems. I'm trying to pick things up as fast as possible but alot of this is beyond my current skills, things are a bit messy so please bear with me!

I've uploaded a zip file including a sample of my database and alterations to date.
https://filedb.experts-exchange.com/incoming/ee-stuff/7444-LinkedDropdowns.zip

(dbfunredux_ajax_stock.htm) Here's what I'm trying to achieve.
a) The manufacturers dropdown is to display all available manufacturers, but no duplicate names. With the manufacturer dropdown can it be altered so that when you make a selection it populates the model dropdown not itself.
b) The model dropdown is to display all models relating to the selected manufacturer, again no duplicate names.
b) Now I've also tried adding a third dropdown box named deriative which needs to be populated by the selection made in the model dropdown.
c) I also wanted to remove the preset 'Please select one' that is displayed and just have a blank select box before a selection is made. Where is this stored as I could'nt find it?

On your original dbfunredux_ajax.htm, the final result is written out as text, can this be replaced by the deriative dropdown and it's options.

(dbfunredux_ajax_lookup_stock.asp) Here's what I'm trying to achieve.
The 1st SQL Case 1 - needs to gather all manufacturers, but no duplicates.
The 2nd SQL Case 2 - joins models to manufacturers, again no duplicate names
The 3rd SQL Case 3 - joins deriatives to models, and as with the other two no duplicate names.

I hope all this has been explained well enough to get the idea out, if not just ask. I do appreciate your help with this project.

Thanks
Dan


b0lsc0ttIT ManagerCommented:
Dan,
I'm glad I could help.  Let me know if I am off but it seems most of what you mentioned or asked is continuing on in this project from what was originally asked here.  If I am right then we really need to close this question and, if you need help with another part, open a new question for it.  We can't take care of all of the questions, answers and a whole project in one question.
Let me know your response to the above, especially if you feel the original question has not been answered.  I know there is more to do in the project but it is important to do things as they are suppose to be done for stuff on this site.  Let me know if you have a question.
bol
DanielR6Author Commented:
Bol, no your right, all my questions can't be answered at once, thanks again for your help so far, i'll post the other questions individually.

Dan
b0lsc0ttIT ManagerCommented:
Your welcome!  I'm glad I could help.  It has been a fun question.  Thanks for the grade and the points.
If you do open new questions and would like my attention to them then feel free to post the new question's URL here in a comment.  I have less time to help on EE right now so might not be able to respond quickly but would be glad to look and try, especially if you get no other responses or the question stalls.
bol
DanielR6Author Commented:
Hi bol,

I've opened a new question with regards to one of the questions I posted above. I've displayed the coding that you supplied me as it was originally, I hope thats ok. I tried altering it to fit my database but it got completely screwed up, so I thought I go through each step bit by bit.

The new post is here:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/ASP/Q_24050625.html

Dan
b0lsc0ttIT ManagerCommented:
Dan,
Thanks.  I have saved a bookmark to the page and will try to look at it later.  If I can help I will post but right now I have been pretty busy with other things.  Haven't had much time for EE and, when I do, just quick stuff.  I will definitely look at it though when I can.  Luckily there are also many other experts here too. :)
bol
DanielR6Author Commented:
bol,

I know you're busy with things other than EE, but have you had any chance to look at my question, as I've had 0 replies from any other expert and now hit a bit of a brick wall on things.

Cheers
Dan
b0lsc0ttIT ManagerCommented:
Dan,
I will try to take a look tonight or in the next few days.  I am just swamped with work projects and contract jobs.  I have to make time for those things first when they come up.  Having a motherboard die Friday night did not help things for my free time this weekend.  I will try to spend at least a few minutes tonight and see if I can post to get things moving.
bol
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.