Link to home
Start Free TrialLog in
Avatar of kayz
kayz

asked on

Drop down menu with multiple values

In my asp page, I have created a drop down menu and with a radio button. How do i configure in asp script or any vb/java script to display a number of radio button base on the selection made in the drop down menu. I will give list to drop menu as 1, 2, 3, and 4. When people click on 2, means that 2 radio buttons will be displayed, and if they click 3 then 3 radio buttons will come out an so forth. How to configure that??

Can somebody let me know, I really appreciate that

Thank you so much
ASKER CERTIFIED SOLUTION
Avatar of etmendz
etmendz

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 saf_islam24
saf_islam24

hi,

I believr, there are two ways of going about it.

If you can be sure that your application will be used only in IE5x then you could go for the CREATE ELEMENT method to dynamically generate the radio buttons according to the user selection.

Otherwise , since the possible otions seem to be known beforehand (1-4), so you could create four radios and then control their display( show/hide) properties according to the user selection.

Any particular reason why this question is listed in ASP and not javascript, since your requirement  is primarily client-side code, if I am not to be corrected.

Regds,
Saif
Avatar of kayz

ASKER

I will try your code, thanks a lot...i really appreciate it
Avatar of kayz

ASKER

Is it same if I use another control like other drop down menu? Because I use another drop down menu to make another selection. The scenario is like this, people will choose number of option in the first drop down menu, if they choose 2 meaning another 2 drop down menu will come out. And in respective drop down menu, I put another option/list of selection. All the list of selection is actually a data in database. Do I need to write do while.. loop for every drop down menu in my asp page?
If data for each new dropdown will be coming from the database, it'll be best to submit the form after each change of selection from the first drop down.

Just add onchange="javascript:document.submit()" to your <select> and generate the HTML codes from the server side. Since you're on the server already, it will be best to resolve for everything that you will display there. This way, you won't need much JavaScript.

Otherwise, you can try the dropdown menu parent-child relationship technique. You will have to expose your database as JavaScript arrays when you do this (if it is not much of a security issue).