Link to home
Start Free TrialLog in
Avatar of aks143
aks143

asked on

Multiple dropdown boxes

Hello All,

I wants to have 4 interrelated drop down boxes. What is the best way to handle such kind of stuffs. Any ideas????
or any links??

thanks and regards
Avatar of cheekycj
cheekycj
Flag of United States of America image

how are the related and what kind of interaction do you want?

CJ
Avatar of aks143
aks143

ASKER

Hello cheekyci,

thanks for the response.

I mean to say, for example:

four dropdowns of countries, state, cities and streets. If you select country , the next will show all the states of that country and the next will show all the cities of that state and the last will show all the streets of that city.

Am i clear with my question???
All the values will be fetched from database.

thanks and regards
I have answered a similar question: https://www.experts-exchange.com/questions/20405435/Populating-Values-dynamically-in-drop-down-boxes.html

let me know if you have further queries.
Avatar of aks143

ASKER

Hello Kennethxu,

Thanks for ur reply. But, i m not reading the values from xml file...but from database directly. Well, i had done this in my application...but, the problem i m facing is of speed...Let me explain my problem.

I did the combo boxes by querying the database. First i make the table with outerjoins and then with java logic..took the choices into vector. I suppose, this approach is fine. But, in one of the choices at first dd box...the server is taking too much of time..that my browser didn't respond. How come this problem can be solved??? If i write the xml file and read the choices from that...will that improve the speed??? I think No.

How can i acheive a better speed???
Please respond.
thanks
>> the server is taking too much of time..
we should 1st try optimize the database and/or query, if that doesn't help, we'll have to cache the result to improve performace. i have good experience in tuning query and DB, let me know if you need help on this.
 
>>  If i write the xml file and read the choices from that...will that improve the speed???
the answer is yes. in fact, the best solution is depend on how large your data is and how much we can tune you query performance.

we can cache data in xml file, flat file, a List as session or application attribute, there are solutions.

can you let me know more about the detail.

Thanks

Avatar of aks143

ASKER

Hello Kennethxu,

I believe the problem in my case is that, browser is not able to handle a large quantity of data. I would love to solve this problem by ur kind help. But, if u think u can carry on this in personal mails, that would be more better.
Otherwise, we will continue here itself.

My personal mail id is vickansh@yahoo.com

please reply.
thanks and regards

I send you an email. EE doesn't like their member to use email to communicate because they think everybody should have fair access to information.
You can continue post here so other expert can see it and provide help, or you can email me the detail if you prefer.

but i don't know if this is fine for CJ :)
:-)

aks143: It is better if you post the data here (EE policies not mine)  If solutions and code are not posted I have seen EE Admins/Moderators delete the question.

If the code is too much to post here then please post a link to it on the web (the link must be permanent so that future users of EE can refer to it)

CJ
Avatar of aks143

ASKER

Thanks cheekyci for the clarification. I don't have any problem, posting my data or code here. I will keep this in mind.

hello Kennethxu,

I am using mysql database.

This is the query used to get a joined table for the four interrelated dds:

select SD.supplier, SD.depot, SD.part, VF.family_name
FROM static_data SD left outer join families VF
ON SD.supplier = VF.supplier
AND SD.part =  VF.part
ORDER BY SD.supplier,SD.depot, SD.part

Then i m making vectors for the above columns and then using javascript populating the interrelated
dropdown boxes. It works fine in some cases but, not in few where i have too much of data.

You were telling me something about caching the server response. Could you please elaborate on the same??

Please guide
thanks and regards


is these select for all 4 dropdown boxes or just one dropdown box?

how many rows are you expecting from this query? do you have index on (supplier+part) column in both table?
Avatar of aks143

ASKER

This is the select statement for all the dds. For ex. by selecting one of the supplier, user will get the corresponding depots in another dd and then corresponding part for the selected depot and the corresponding family name for the selected part.

One of the supplier returns 10,000 parts....i hope there goes the problem.

I have indexes on both the tables for supplier and part.

thanks and regards
you need index of( supplier, depot, part ) on your static_data table, and index( supplier, part ) on families table.

and I would suggest you to seperate query into 4, one for each box:

supplier box1:
select distinct supplier from static_data

depot box2:
select distinct depot from static_data where supplier = current_supplier_selected_in_box1

part box3:
select part from static_data where supplier = current_supplier_selected_in_box1 and depot = current_depot_selected_in_box2

family box4:
select family_name FROM where where supplier = current_supplier_selected_in_box1 and part = current_part_selected_in_box3

this way you limit the number of rows returned from database in each request and avoided the join.

if you have a seperate supplier and/or depot table, the performance will be even better.

everytime user change one box, resumit and get the new list as I illustrate in above link.
ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aks143

ASKER

Hello Kenneth,

You are charm!!!!!!!!!!!!!!!!
Your code works very fine.....thank you very much for the efforts...

keep up the good work. It was quite a good learning work for me. I don't have too many points in my account...otherwise i would have given my all.

Thanks and regards
aks143
my pleasure to help and thanks for your points
can anyone tell me what does location.replace(action); do in the above code.
Thanks
can anyone help me to understand above code. I was wondering how javascript works there.thanks
Radhika
i observed something the select boxes whose values r dependent on other select boxes are the ones not showing the selected values.