By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,635 Members | 2,060 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,635 IT Pros & Developers. It's quick & easy.

Multiple select box to populate another select box

P: 8
Hi There,
I am creating a survey that asks users what countries they have worked in, and which regions in those countries. Because there can be many answers, I was thinking I could populate a multiple select box, using php and mysql, containing the countries. When the user selects a country, another select box containing the regions in that country would appear (using Javascript onchange event handler).

My problem is that since multiple countries can be selected, multiple secondary select boxes must be created for several onchange events. I am thinking that I should use another event handler for this one, maybe onclick. Or I should just scratch my idea of creating boxes dynamically and use JS to validate that the region selected is in a country that has also been selected?

Any ideas?
Jul 4 '08 #1
Share this Question
Share on Google+
3 Replies


P: 8
I decided to go with checkboxes instead and use the onclick event handler to display the drop down choices.

Thanks,
Jul 4 '08 #2

hsriat
Expert 100+
P: 1,654
I decided to go with checkboxes instead and use the onclick event handler to display the drop down choices.

Thanks,
You took a good decision. That would look better than select box and would be easier for JavaScript.
Jul 4 '08 #3

acoder
Expert Mod 15k+
P: 16,027
One other way you could do it is to have a single select box which populates a single region select box and the user can select countries/regions one by one which appear as text (which can be removed if need be).
Jul 4 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.